I'm new here I'm stuck on a functionality that I want to implement into my website : the Sign-In button using Google
For now, the following code add the Google Sign-In button and works fine :
<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>
But according to the Google documentation, I need to use a "GoogleAuth.signOut()", and I don't know how to implement it in order to disconnect the actual user from my website and I found nothing on the web
Could someone help me in the implementation process of the logout action?
Thanks to everyone
You should have the following code to run after your page is loaded
gapi.load('auth2', function() {
gapi.auth2.init({'client_id':<client_id>});
});
Then when user clicks on your logout button, it should trigger the following code (which is your GoogleAuth.signOut())
gapi.auth2.getAuthInstance().signOut();