Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google SignIn user authentication opening in Popup window, need to open in same Tab itself using OAuth 2.0

I am using OAuth 2.0 for google SingIn, it is opening a popup window for user authentication but i want to open in same tab itself, please help me. Thanks in advance.

like image 983
Jayasenthil Avatar asked Feb 18 '16 07:02

Jayasenthil


2 Answers

The popup window opens if you use Google Sign-In JavaScript library. You have to use server side api client libraries to authenticate / authorize without a popup. https://developers.google.com/identity/protocols/OAuth2WebServer

like image 53
agektmr Avatar answered Nov 22 '22 19:11

agektmr


You can use ux_mode: redirect to change Google to Redirect mode which will open in the same tab instead of in a popup.
Ref: https://developers.google.com/identity/sign-in/web/reference#gapiauth2clientconfig

Then on your redirect landing page, use auth2.currentUser.get() to retrieve the signed in Google User object.


(I know this is an old question, but this was one of the first results in a web search; thought it might help others who end up here as well)

like image 42
cometfish Avatar answered Nov 22 '22 19:11

cometfish