← Back to discussions

Google Sign-In works in Chrome but not inside WebView. Anyone fixed this?

KKartik MPublished 6/23/2026407 views2 comments

We are loading our site inside the Android WebView. Regular email login is working fine, but Google login fails with an error: 'disallowed_useragent'.

It seems Google blocks authentication requests from within WebViews for security reasons. Has anyone found a workaround for this? Do we have to implement native Google SDK login and pass the tokens to the WebView, or is there a simpler header or User-Agent trick?

2 Comments

LLuke Lopez6/23/2026

If you are using Nativine, check the documentation. You can set the user-agent string or use the Firebase OAuth redirection config. Another quick bypass is to customize the User-Agent string to look like a standard mobile browser, though this violates Google's policies and they might block it later:

Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Mobile Safari/537.36

The best and safest long-term fix is native token passing.

NNoopur6/23/2026

Google explicitly blocks OAuth requests inside WebViews to prevent MITM attacks. The recommended way is to use a Custom Tab (like Chrome Custom Tabs on Android or ASWebAuthenticationSession on iOS) for OAuth.

Alternatively, you can implement the native Google Sign-In SDK on the app side, obtain the ID token, and pass it to your backend via a JS bridge interface, then log the user in.

Please log in to reply.
WhatsApp