Google Oauth2 in embedded browser (webview)

I added Google OAuth2

to my site. I noticed that when opening the website in the embedded browser (webview), the redirect to the google login page (see link below) will fail:

"403 disallowed_useragent".

Here is the link:

https://accounts.google.com/o/oauth2/v2/auth?client_id=813505898895-9vocl0haapnp562pn1hmut2sibregabn.apps.googleusercontent.com&response_type=code&scope=openid%20profile%20email2%www.http: //openid%20profile%20email2% www. 2Fauth1% 2Fsign-in% 2Fgoogle & state = 6515338772758876.% 2F

I realized that Google no longer allows requests OAuth

to Google in the web view. But here's the weird thing. Google sign in demo developers.google.com/identity/sign-in/web/sign-in works great when opened in webview. I was able to find client_id

and redirect_uri

used in the demo and replace them with my google auth link (see updated link below), the updated link can now magically open in webview.

https://accounts.google.com/o/oauth2/v2/auth?client_id=831371170934-udapit5jhjj56pft5l2drc9gjhfeclf3.apps.googleusercontent.com&response_type=code&scope=openid%20profile%20em=code&scope=openid%20profile%20em%20em% -firect appspot.com% 3Fid% 3Dauth58372 & state = 6515338772758876.% 2F

Please note that I have changed only client_id

and redirect_url

nothing else. I later found more client_ids

that works with webview too. I am wondering if there are any specific settings for these client_ids to work?

Also I want to know what is recommended to fix:

"403 disallowed_useragent"?

My site doesn't have its own app. And most likely, people will just open the website they received from the online chat. I don't want to show:

"403 disallowed_useragent"

error when they click *sign-in by Google*

.

+3


source to share





All Articles