新的 firebase 更新:弹出 window for Google Auth 没有出现在 Ionic 中
new firebase update: popup window for Google Auth does not show up in Ionic
我最近更新到几天前刚出来的新 firebase。由于它没有 Cordova/Ionic 特殊页面,我假设我需要将其用于 Web。我已设置好所有内容,但 signInWithPopup 函数在实际 phone 设备上不起作用。它在网络浏览器中运行良好。我之前已经为之前的版本将 firebase 列入白名单,之前的版本一切正常 version.Does 有人知道吗?任何帮助,不胜感激!
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
这是我的内容安全政策中的内容
<meta http-equiv="Content-Security-Policy" content=" img-src 'self' data:
http://*.google.com
http://*.gstatic.com
http://*.googleapis.com
http://*.firebaseio.com
https://*.google.com
https://*.gstatic.com
https://*.googleapis.com
https://*.firebaseio.com
最后我允许在 config.xml
中导航所有内容
<allow-navigation href="*" />
目前 Firebaseu V3 身份验证的 signInWithPopup/Redirect 在 cordova 应用程序中不起作用。
弹出窗口和重定向在移动设备上不起作用。您可能需要使用 cordovaOauth 或任何其他第三方获取访问令牌,然后使用 signInWithCredential() 对用户进行身份验证并获取 firebase 用户数据。
这是一个很好的例子:
http://www.clearlyinnovative.com/firebase-3-0-ionic-facebook-login
在我的 Ionic2 RC1 + Firebase3.5 + AngularFire2.beta5 项目中,我遇到了同样的问题... Google Auth with Popup 在浏览器中有效,但在我的 Android.APK
首先,我将 192.168.1.172 添加到我的 Firebase 控制台授权域列表,并将 <allow-navigation href="http://192.168.1.172:8100"/>
添加到我的 config.xml.
之后,我发现installing Cordova InAppBrowser插件彻底解决了我的问题。
我不需要修改我的代码,只需即插即用,就像 David East 在他的 Social login with Ionic blog.
中所说的那样
我最近更新到几天前刚出来的新 firebase。由于它没有 Cordova/Ionic 特殊页面,我假设我需要将其用于 Web。我已设置好所有内容,但 signInWithPopup 函数在实际 phone 设备上不起作用。它在网络浏览器中运行良好。我之前已经为之前的版本将 firebase 列入白名单,之前的版本一切正常 version.Does 有人知道吗?任何帮助,不胜感激!
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
// ...
});
这是我的内容安全政策中的内容
<meta http-equiv="Content-Security-Policy" content=" img-src 'self' data:
http://*.google.com
http://*.gstatic.com
http://*.googleapis.com
http://*.firebaseio.com
https://*.google.com
https://*.gstatic.com
https://*.googleapis.com
https://*.firebaseio.com
最后我允许在 config.xml
中导航所有内容 <allow-navigation href="*" />
目前 Firebaseu V3 身份验证的 signInWithPopup/Redirect 在 cordova 应用程序中不起作用。
弹出窗口和重定向在移动设备上不起作用。您可能需要使用 cordovaOauth 或任何其他第三方获取访问令牌,然后使用 signInWithCredential() 对用户进行身份验证并获取 firebase 用户数据。
这是一个很好的例子: http://www.clearlyinnovative.com/firebase-3-0-ionic-facebook-login
在我的 Ionic2 RC1 + Firebase3.5 + AngularFire2.beta5 项目中,我遇到了同样的问题... Google Auth with Popup 在浏览器中有效,但在我的 Android.APK
首先,我将 192.168.1.172 添加到我的 Firebase 控制台授权域列表,并将 <allow-navigation href="http://192.168.1.172:8100"/>
添加到我的 config.xml.
之后,我发现installing Cordova InAppBrowser插件彻底解决了我的问题。
我不需要修改我的代码,只需即插即用,就像 David East 在他的 Social login with Ionic blog.
中所说的那样