react-oauth icon indicating copy to clipboard operation
react-oauth copied to clipboard

Logout function not working ' Uncaught TypeError: google_logout is not a function '

Open adventuretocode opened this issue 2 years ago โ€ข 11 comments

Error : Logout function not working ' Uncaught TypeError: google_logout is not a function '

code example custom logout button ` import { googleLogout } from '@react-oauth/google';

return (

<GoogleOAuthProvider clientId={CLIENT_ID}>
       <button onClick={() => login()}>
        Sign in with Google ๐Ÿš€{' '}
        </button>;  

<button onClick={() => googleLogout}> Logout Google ๐Ÿš€{' '} ;

    </GoogleOAuthProvider>


</div>

); `

adventuretocode avatar May 03 '23 13:05 adventuretocode

googleLogout itself is a function it doesn't return anything so your variable is undefined

You need to call it directly on the button

MomenSherif avatar May 03 '23 13:05 MomenSherif

@MomenSherif here is code but still not logout no any response <button onClick={() => googleLogout}> Logout Google ๐Ÿš€{' '} </button>

adventuretocode avatar May 03 '23 13:05 adventuretocode

<button onClick={() => googleLogout()}> Logout Google ๐Ÿš€{' '}

MomenSherif avatar May 03 '23 13:05 MomenSherif

@MomenSherif nothing happens when i click on Logout button. can you please suggest any debug way !

adventuretocode avatar May 03 '23 13:05 adventuretocode

<button onClick={() => googleLogout()}> Logout Google ๐Ÿš€{' '}

This doesnt work. My Google Sign In button logged me in as expected and shows my email and name on the button. But when I call this API and then reload the page, the button still shows my name and email meaning that I have not been logged out. How to make this work? @MomenSherif

jaydeepw avatar Jul 08 '23 16:07 jaydeepw

I have the same issue with logout. What do I wrong here? @MomenSherif

<GoogleOAuthProvider clientId='my-id'>
                <GoogleLogin
                  onSuccess={credentialResponse => {
                    console.log(credentialResponse)
                  }}
                  onError={() => {
                    console.log('Login Failed')
                  }}
                />
                <Button
                  type='button'
                  onClick={googleLogout}
                >
                  Logout
                </Button>
              </GoogleOAuthProvider>

@jaydeepw have you fixed that?

PoulWalcker avatar Jul 25 '23 18:07 PoulWalcker

Has anyone fixed this issue? I am still having this.

AbdulHadi806 avatar Oct 05 '23 16:10 AbdulHadi806

Also having this issue

airowe avatar Jan 11 '24 22:01 airowe

provided googleLogout() is not working. the token is still valid after this method is invoked.

WaleedShahzaib avatar Feb 02 '24 10:02 WaleedShahzaib

import { googleLogout } from '@react-oauth/google

This library has this issue which you are facing, there is no fix for this with this library as far as I know. I would recommend you to use something else, maybe firebase auth but it's all up to you.

AbdulHadi806 avatar Feb 02 '24 13:02 AbdulHadi806

@react-oauth/googleย library has the issue you're facing for logging out, and as far as I know, there is no fix for it within this library. I would recommend you to use something else, perhaps Firebase Authentication, but the choice is up to you. On Friday, February 2, 2024 at 02:04:51 AM PST, WaleedShahzaib @.***> wrote:

provided googleLogout() is not working. the token is still valid after this method is invoked.

โ€” Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

AbdulHadi806 avatar Feb 02 '24 13:02 AbdulHadi806