Geo*_*rge 5 javascript google-authentication
我正在使用https://apis.google.com/js/platform.js进行 google 登录。
我遇到的问题是,用户登录后,他们将无法选择不同的帐户/电子邮件进行登录,即使在注销后也是如此,因为当他们再次登录时,它会自动选择他们之前选择的帐户。
这是我的代码:
HTML (pug):
div(id="sign-in-out-nav")
div(class="g-signin2" data-onsuccess="onSignIn")
a(href="#" onclick="signOut();") Sign out
JavaScript:
function onSignIn(googleUser) {
const profile = googleUser.getBasicProfile();
const name = profile.getName();
const email = profile.getEmail();
const id_token = googleUser.getAuthResponse().id_token;
sendTokenAndVerify(id_token)
.then((data) => {
if(data.error || data.success === false){
return signOut(data.message || "Token could not be verified.");
}
})
//...more code...
}
Run Code Online (Sandbox Code Playgroud)
我还有一个按钮可以让他们退出。
如何允许用户切换帐户?
| 归档时间: |
|
| 查看次数: |
154 次 |
| 最近记录: |