【发布时间】:2017-09-23 12:21:39
【问题描述】:
我正在使用 ionic 2 构建一个应用程序,并且我在其中有一个登录系统。我正在使用 firebase 和 angularfire2 连接到 firebase 并使用 firebase 提供的身份验证系统。以下是我用于 facebook auth 的代码。
loginwithfacebook() {
this.angfire.auth.login({
provider: AuthProviders.Facebook,
method: AuthMethods.Popup
}).then((response) => {
console.log('Login Success with facebook' + JSON.stringify(response));
let currentuser = {
email: response.auth.displayName,
picture: response.auth.photoURL
};
window.localStorage.setItem('currentuser', JSON.stringify(currentuser));
this.navCtrl.push(Dashboard);
}).catch((error) => {
console.log(error);
})
}
当我运行ionic serve 时,这在浏览器中运行良好,但是当我在我的 android 5.0 中使用ionic run android --device 对其进行测试时,当我单击“使用 facebook 登录”按钮时,弹出窗口不会出现。我尝试使用cordova add plugin inappbrowser,但弹出窗口出现并关闭并且不起作用。我也试过crosswalk,当我点击按钮时应用程序关闭。我该如何解决这个问题?
【问题讨论】:
-
Firebase 3.x 现在支持 Cordova 的 OAuth 登录:firebase.google.com/docs/auth/web/cordova
标签: cordova ionic-framework ionic2 firebase-authentication angularfire2