问题描述
我正在开发离子和firebase项目,登录页面使用谷歌登录。 var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth()。signInWithRedirect(provider).then(function(result){
var token = result.credential.accessToken;
//登录的用户信息
var user = result.user;
$ state.go('app.homepage');
})。catch(function(error){
});
firebase.auth()。getRedirectResult()。then(function(result){
if(result.credential){
var token = result.credential.accessToken;
}
//登录的用户信息
var user = result.user;
})。catch(function(error){
});
当我在浏览器中运行它时工作正常,但是当我在android设备上运行它时我在这个环境中获得了auth / operation-not-supported。
应用程序正在location.protocol上运行。
我研究了一下,但找不到确切的答案。什么可能是错误的?
auth.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(fbAccessToken));
$ 20cordova / firebase-talk / mC_MlLNCWnI / DqN_8AuCBQAJ
I am working on ionic and firebase project, made a login page to sign in with google. I am using this Below.
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithRedirect(provider).then(function (result) {
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
$state.go('app.homepage');
}).catch(function (error) {
});
firebase.auth().getRedirectResult().then(function (result) {
if (result.credential) {
var token = result.credential.accessToken;
}
// The signed-in user info.
var user = result.user;
}).catch(function (error) {
});
When I run it in the browser it is working fine, but when I run it in android device I am getting auth/operation-not-supported-in-this environment.The application is running on "location.protocol".I researched a bit but could not find an exact answer. What could be wrong ?
popup and redirect operations are not currently supported in Ionic/Cordova environment. As a a fallback you can you an oauth cordova plugin to obtain a google/facebook OAuth access token and then sign in the user via signInWithCredential. Check this thread for more on this:
auth.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(fbAccessToken));
https://groups.google.com/forum/#!searchin/firebase-talk/facebook$20cordova/firebase-talk/mC_MlLNCWnI/DqN_8AuCBQAJ
这篇关于此环境中不支持FIrebase Google身份验证操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!