question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<GoogleLogout /> does not log out

See original GitHub issue

Added login and logout buttons on page as below: <GoogleLogin clientId="xxx" buttonText="Login" onSuccess={responseGoogle} onFailure={responseGoogle} /> <GoogleLogout buttonText="Logout" onLogoutSuccess={logout} />

Steps I followed: 1.Clicked Login button, logged in with my google credentials 2.Clicked Logout button 3.Clicked Login button again

Expected: On step 3 I should see login popup by google again as I did click logout button in step 2.

Actual: On step 3, I didn’t saw login popup and I am auto-logged in

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:32 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
TommieEdwardBerrycommented, Feb 15, 2018

I had this same problem and worked on it for days. I am using cookies to store the GoogleID, and everything worked as long as I did not refresh while logged in. The refresh kills the GoogleLogout object, so it won’t click anymore. The comments above really helped and made me try to create my own clickable logout image and just replace the GoogleLogout component with a clickable image like this:

<img onClick={forceMyOwnLogout} src={RedLogoutPicture} alt=“LO” width=“100” />

The code in forceMyOwnLogout is similar to above, except I added an if to make sure the window.gapi exists and this.forceUpdate() at the end. It works very well, and the only side effect, which I actually like is that you are forced to select the logger-inner instead of just logging in without asking who ! Here is the code:

  var forceMyOwnLogout = ((response) => {
      cookie.remove('MyGoogleID', { path: '/' })
      if (window.gapi) {
          const auth2 = window.gapi.auth2.getAuthInstance()
          if (auth2 != null) {
              auth2.signOut().then(
                  auth2.disconnect().then(this.props.onLogoutSuccess)
              )
          }
      }
      this.forceUpdate()
  })
8reactions
ramonckcommented, Oct 14, 2018

You are welcome to submit a PR to fix it.

When I get sometime I will look into it, it’s a good project but this Logout issue is killing it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Sign out not working properly using react
<GoogleLogin> is working fine . But when i tried to logout it just setting the state out. From the below code one can...
Read more >
Sign out of Gmail - Android - Google Support
The only way to sign out of the Gmail app is to remove your entire account from your phone or tablet. However, you...
Read more >
How to Sign Out of Your Google Account on All Devices at Once
1. Go to https://myaccount.google.com/device-activity in a web browser. You can use any web browser, like Google Chrome, on your phone, tablet, or computer...
Read more >
Log out of Facebook | Facebook Help Center
Was this helpful? How could it be better? Keep in mind that this form is for feedback only and you won't receive a...
Read more >
Signing Out Users and Disconnecting Accounts | Authentication
Sign out users; Disconnect accounts. Note: Google Sign-In for Android is based on an older, legacy library that lacks many new features now ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found