【发布时间】:2017-07-07 20:31:14
【问题描述】:
我使用 Google 作为身份验证提供商来登录我的应用。我的代码调用了重定向到登录页面的 Firebase 退出方法,但是当用户再次单击 Google 登录按钮时,它会自动进行身份验证并登录到应用程序而不会提示用户。登录代码如下:
$('#GooglePluseLogin').click(function (e) {
showLoaderPF(true);
if (!firebase.auth().currentUser) {
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('https://www.googleapis.com/auth/plus.login');
firebase.auth().signInWithRedirect(provider);
} else {
firebase.auth().signOut();
showLoaderPF(true);
}
});
还有,这里是登出的代码:
firebase.auth().signOut().then(function () {
debugger;
localStorage.clear();
deleteAllCookies();
// firebase.auth().unauth();
window.location.href = "index.html";
}, function (error) {
showLoaderPF(false);
console.error('Sign Out Error', error);
});
【问题讨论】:
-
不清楚这里有什么问题。是您没有从 Google 提供商退出而仅从 Firebase 退出的问题吗?如果是这样,这是意料之中的。
-
我也有这个问题。从 Firebase 退出不会从 Google 或类似情况退出。下次登录尝试将使用相同的凭据,并且用户无法更改用于登录的帐户(并且密码也以某种方式存储)退出按钮真的应该也忘记以前使用的密码,对吗?
-
我现在使用
GIDSignIn.sharedInstance().signOut()来解决我的问题(因为我的应用目前使用谷歌身份验证),它让我在下次尝试时选择另一个帐户,但是有些东西(SFSafariViewController?)记住了密码在幕后......我猜用户可能必须在设置>Safari等中擦除某些内容才能删除该密码。 -
嗨 @Jonny,什么是 GIDSignIn 对象?
-
@Talha 我使用 iOS 框架。我知道你不是,对不起。我还不太习惯 Firebase 系统,但也许 iOS 框架只是一个与 Web 工具相同/相似功能的包装器,所以我们共享同样的问题。
标签: javascript firebase firebase-authentication firebase-security