Cordova inAppBrowser 不适用于 firebaseAuth [英] Cordova inAppBrowser won't work with firebaseAuth

查看:30
本文介绍了Cordova inAppBrowser 不适用于 firebaseAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用离子框架构建一个混合应用程序.

I am building a hybrid app using the ionic framework.

我将 angularFire 2.0 与 Firebase 3.0 结合使用.我安装了cordova插件inAppBrowser".

I'm using angularFire 2.0 with Firebase 3.0. I have the cordova plugin "inAppBrowser" installed.

在已折旧的 Firebase 文档中,我只需要 authWithOAuthPopup() 启动一个 inAppBrowser 窗口并执行登录过程即可.

In the depreciated Firebase documents, that's all I need to have authWithOAuthPopup() fire up an inAppBrowser window and do the login process.

目前,我正在使用 signInWithPopup() 并且它在我的 iOS 应用程序中没有任何作用.该应用在使用 ionic serve 的浏览器中运行良好.

Currently, I am using signInWithPopup() and it does nothing in my iOS app. The app works fine in browser using ionic serve.

推荐答案

即使安装了 inAppBrowser 插件,Cordova 环境当前也不支持 Firebase 3.0 signInWithPopup/Redirect.在支持此功能之前,您可以使用其他插件获取 Facebook、Google 的 OAuth 响应,然后改用 signInWithCredential.您可以使用类似 https://www.npmjs.com/package/cordova-plugin-facebook 获取 Facebook 访问令牌,然后通过 auth.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(fbAccessToken)) 登录;

Firebase 3.0 signInWithPopup/Redirect is not currently supported in a Cordova environment even with inAppBrowser plugin installed. Until this is supported, you can use other plugins to get the OAuth response for Facebook, Google and then use signInWithCredential instead. You can use something like https://www.npmjs.com/package/cordova-plugin-facebook to get the Facebook access token and then sign in via auth.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(fbAccessToken));

这篇关于Cordova inAppBrowser 不适用于 firebaseAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆