1

我正在关注 Firebase 网站上的 Facebook Auth 教程。你可以在这里看到它:https ://www.firebase.com/docs/web/libraries/ionic/guide.html

$scope.login = function() {
Auth.$authWithOAuthRedirect("facebook").then(function(authData) {
  // User successfully logged in
}).catch(function(error) {
  if (error.code === "TRANSPORT_UNAVAILABLE") {
    Auth.$authWithOAuthPopup("facebook").then(function(authData) {
      // User successfully logged in. We can log to the console
      // since we’re using a popup here
      console.log(authData);
    });
  } else {
    // Another error occurred
    console.log(error);
  }
});
};

我的问题是我正确收到了 TRANSPORT_UNAVAILABLE 错误,并且我正在进入以下代码行

Auth.$authWithOAuthPopup("facebook").then(function(authData) {
  // do stuff with the authData
})

但是,当我在我的设备或模拟器中运行时,来自 InAppBrowser 插件的弹出窗口会立即关闭,并且不允许我输入任何凭据。

编辑

有两点需要注意。首先,通过浏览器完成上述代码的身份验证不起作用。所以,如果我这样做ionic serve并尝试登录,除了我看到 url 短暂更改为http://localhost:8100/#/login&__firebase_request_key=0wRrfF07Ojg1PmJXNX1OsvrRFR2Q1LGj 但它又回到http://localhost:8100/#/login

其次,当我通过 Xocde 构建项目并在我的设备上运行时,InAppBrowser 插件似乎不再立即关闭,而是以白屏冻结。Xcode 中的日志显示如下

THREAD WARNING: ['InAppBrowser'] took '79.103027' ms. Plugin should use a background thread. NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) webView:didFailLoadWithError - -1200: An SSL error has occurred and a secure connection to the server cannot be made. 编辑 2

看起来 SSL 错误的上述问题是因为升级到 ios 9 时出现了一个不相关的错误。我已经纠正了这些问题,现在我又回到了原来的状态。除了现在 InAppBrowser 窗口甚至没有打开之外,我仍然使用 TRANSPORT_UNAVAILABLE 击中 catch 块。

4

1 回答 1

1

不确定我是如何解决这个问题的。很难区分最初破坏的内容和由于 ios 9 升级而破坏的内容。但是,我已经能够解决这个问题。/ios我首先/android/platforms. /plugins我还从文件夹中删除了所有插件。

然后我添加回 ios 和 android 平台。然后我添加了插件。然后我按照这 2 篇博客文章中的步骤将您的应用修改为 ios 9 恭维。

http://blog.ionic.io/ios-9-potential-break-change/

http://blog.ionic.io/preparing-for-ios-9/

于 2015-09-17T23:29:02.363 回答