I am migrating to the new-ish google auth api based on google.accounts.id
and documented here https://developers.google.com/identity/gsi/web/guides/display-button
Using the old API I was able to check if a user was logged in before displaying the login button using gapi.auth2.getAuthInstance().isSignedIn.get()
.
What is the equivalent with this new google.accounts.id
approach?
According to their docs, that method has been removed and it's now up to you to directly manage the state of a user's session state: https://developers.google.com/identity/oauth2/web/guides/migration-to-gis?authuser=1#session_state.
I'm dealing with the same issue as you and found this possible workaround using a Cookie instead to track the user's session state. It might be helpful in your situation: https://stackoverflow.com/a/68855272/8056536