【问题标题】:Ionic Firebase Auth Popup Window Closes ImmediatelyIonic Firebase 身份验证弹出窗口立即关闭
【发布时间】:2015-09-17 16:03:49
【问题描述】:

我正在关注 Firebase 网站上的 Facebook 身份验证教程。你可以在这里看到它: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 块。

【问题讨论】:

    标签: firebase ionic facebook-authentication firebase-authentication


    【解决方案1】:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 2016-03-29
      • 1970-01-01
      • 2015-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-03
      • 2021-10-25
      • 2020-08-28
      相关资源
      最近更新 更多