Google blocks OAuth sign-in in embedded WebViews and shows Error 403: disallowed_useragent, because a WebView app could read the password the user types. Faking the user agent breaks Google's terms and can stop working at any time. The supported fix is to open the Google sign-in page in a Custom Tab (a secure Chrome window) and return to the app, or to offer email/password, magic links or another provider alongside Google.
Why Google blocks it
In a WebView the host app controls the page — it could inject JavaScript and read what you type. Since 2021 Google refuses OAuth requests from embedded WebViews and asks apps to use the system browser instead. Facebook and Apple impose similar limits on their logins in some cases, so plan for all social logins, not just Google.
Fix 1: open sign-in in a Custom Tab
A Custom Tab is Chrome running on top of your app with your toolbar colour. Google allows sign-in there because your app can't see inside it. The flow:
- The app recognises the sign-in URL (
accounts.google.comor your auth provider's domain) and opens it in a Custom Tab instead of the WebView. - The user signs in. Your auth server redirects to a URL your app owns — an App Link such as
https://example.com/auth/app-callback. - Android hands that link to your app, which loads it in the WebView. Your server sets the session cookie there.
The catch: cookies set inside the Custom Tab live in Chrome, not your WebView, so step 3 must carry a one-time code that your site exchanges for a session inside the WebView. Firebase Auth, Supabase, Auth0 and Clerk can all be configured for a redirect flow like this.
Fix 2: give users another way in
The fastest fix needs no app change: put email + password or email magic link / one-time code next to the Google button, and hide the Google button when the site detects the app's user agent. The app mode snippet adds a CSS class you can use:
html.in-app .google-signin { display: none; }
Fix 3: native sign-in (needs app code)
Android's Credential Manager can show the native Google account picker and hand an ID token to your site through a JavaScript bridge. It's the smoothest experience but needs custom native code, so it's beyond what most URL to app converters do.
What not to do
- Don't change the user agent to pretend to be Chrome. It violates Google's policies, Google detects it, and your users get locked out without warning.
- Don't send users to an external browser and hope. They sign in there, but the app's WebView stays logged out.
Test checklist
- Fresh install, no accounts on the phone — does sign-in still complete?
- Sign out and back in; then force-close the app and reopen — still signed in?
- Try the password reset email link — does it open in the app or the browser, and does that matter for your flow?
FAQ
What does disallowed_useragent mean?
Google detected the sign-in request came from an embedded WebView rather than a full browser and refused it, as its OAuth policy requires.
Does Firebase Google sign-in work in a URL app?
Not with the default popup or redirect inside the WebView. Use a Custom Tab flow or Firebase's email link sign-in for the app.
Does Facebook login work in a WebView?
Facebook also restricts login in embedded WebViews for many apps. Treat it like Google: Custom Tab or an alternative login.
Does email/password login work in a URL app?
Yes. Ordinary cookie-based logins work and persist between app launches.