![](/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.