Currently, I have a code as below to run google oauth2. It works perfectly but everytime i open a new tab a pop up will appear for login(however will auto close after few seconds). Is it possible to make it so that pop up will not appear all the time as it is distracting everytime i open a new tab.
tokenClient = google.accounts.oauth2.initTokenClient({
client_id: CLIENT_ID,
scope: SCOPES,
prompt: '',
callback: authorizeCallback
});
tokenClient.requestAccessToken();
When you request an access token, the following things happen:
google.com.google.comsession cookie, which was set when the user logged on to Google.callbackURL that you specify, and the access token is injected into that URL. This allows your app to read the access token.Google can issue an access token only in response to a visit to its web page. If you made the request to
google.comfrom your web page, the session cookie would not be included (it counts as third-party-cookies). Hence a popup is necessary during everyrequestAccessToken(). If you want to avoid a new popup for every new tab your app opens, you must share the access token between all tabs of your app. You can achieve this, for example, by writing the access token into a cookie of your app so that it will be sent to your app server automatically after the user has logged in with Google once.A more detailed answer would require that you share your code which triggers the Google OAuth flow.