Firebase authWithOAuthPopup returns TRANSPORT_UNAV

2020-03-27 03:29发布

I have had success using the authWithOAuthPopup in my html5 application but when I recently created a phoneGap build, it fails on Android.

I have done the obvious thus far that Ive found from other sources:

Added sources to config.xml:

<access origin="*.firebaseio.*" />
<access origin="https://auth.firebase.com" />

Ive also added the InAppBrowser plugin:

<gap:plugin name="org.apache.cordova.inappbrowser" />

In my test, Im able to call window.open on my phone and get another web page to come up so I know the plugin seems to work.

However, when I use the firebase code, Im unable to get any Auth method to work.

Here is some sample code:

rootRef.authWithOAuthPopup(provider, function (err, user) {
if (err) {
if (err.code === "TRANSPORT_UNAVAILABLE") {
// fails here
}
}});

Can anyone tell me what could be wrong?

2条回答
甜甜的少女心
2楼-- · 2020-03-27 03:51

I solved it by adding this line: <script src="phonegap.js"></script>

查看更多
叼着烟拽天下
3楼-- · 2020-03-27 04:12

Adding the below link

<script src="phonegap.js"></script>

Does not work for

firebase.auth().signInWithPopup(provider).then(function(result) {

even after adding

<access origin="*.firebaseio.*" />
<access origin="https://auth.firebase.com" />
查看更多
登录 后发表回答