Google active session with Google Identity Service

Viewed 22

I am currently trying to migrate my application to the new google identity service. I am running into an issue detecting whether or not the user has an active google session. Previously I would check this by doing something like this:

const authInstance = () => {
  const auth2 = _.get(window, 'gapi.auth2');
  if (auth2) return auth2.getAuthInstance();
  return null;
};

Is there anyway to determine whether or not there is a current auth session? I need this because if the user has no active google session I would like to display another component instead.

I understand Google is removing support for this as mentioned here but, I would like to know if there is another way this may be accomplished

I would like to do something like this:

if (!authInstance()) render nonGoogleSignIn;
0 Answers
Related