![](/img/trans.png)
[英]Firebase Sign-in with email after google sign-in has error : The password is invalid or the user does not have a password
[英]Google Sign-In button > How to logout user if he clicks on the google buttons
我是新来的,我被困在一个我想在我的网站上实现的功能上:使用谷歌的登录按钮
现在,以下代码添加了 Google 登录按钮并且工作正常:
<meta name="google-signin-client_id" content="63XXXXXXX-hXXXXXXXXXXdj.apps.googleusercontent.com">
<script src="https://accounts.google.com/gsi/client" async defer></script>
<div id="g_id_onload"
data-client_id="63XXXXXXX-hXXXXXXXXXXdj.apps.googleusercontent.com"
data-login_uri="https://mywebsite.com"
data-auto_prompt="false"
data-auto_select="false"
data-callback="handleCredentialResponse">
</div>
<div class="g_id_signin"
data-type="standard"
data-size="large"
data-theme="outline"
data-text="signin"
data-shape="pill"
data-logo_alignment="left"
data-width=400>
</div>
但根据谷歌文档,我需要使用“GoogleAuth.signOut()”,我不知道如何实现它才能断开实际用户与我网站的连接,我在 web 上什么也没找到
有人可以在注销操作的实施过程中帮助我吗?
谢谢大家
您应该在页面加载后运行以下代码
gapi.load('auth2', function() {
gapi.auth2.init({'client_id':<client_id>});
});
然后当用户点击您的注销按钮时,它应该触发以下代码(这是您的 GoogleAuth.signOut())
gapi.auth2.getAuthInstance().signOut();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.