Reputation: 2328
In scenario 1 the user is not logged into our app and is not logged into google in their browser. This shows them a pop up and tells them to log in to google and then tells them to authorize our app.
However, in my scenario, the user is already logged in and already has authorized my app. I log them in automatically but the problem is that the popup keeps appearing each time.
Is there a way to call the signin of google api without having the popup show?
Thanks in advance.
Upvotes: 2
Views: 1973
Reputation: 162
Since you marked this question as Javascript, I guess you must be using the oauth 2.0 through Google APIs Client Library for JavaScript. https://developers.google.com/api-client-library/javascript/
In this page, https://developers.google.com/api-client-library/javascript/features/authentication. Checkout the Auth example section, when you make the call gapi.auth.authorize(params, callback), set the param immediate to be true, so that the token is refreshed behind the scenes and no UI is shown to the user.
Checkout this page to see more details about the method gapi.auth.authorize(params, callback). https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauthauthorize
Upvotes: 2