Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

Google sign-in blocked with 403 disallowed_useragent inside an app

Errordisallowed_useragent

Short answer

Google refuses OAuth sign-in screens that load inside an embedded browser such as a WebView. The error means your sign-in page was opened by an app, not by the real browser. Send the authorization request to the system browser or an in-app browser tab, and let the user's own browser handle the link.

  • Applies to Google OAuth 2.0, AppAuth, iOS 18, Android 15
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out where the login page is rendering. Open the same URL in Safari or Chrome directly. If it works there and fails only from inside an app, the embedded browser is the cause.

    # Open this in a normal browser tab, not inside any app:
    https://your-app.example.com/login
  2. 2Match what you see, then jump to its fix

    1. 1Error appears only in your mobile or desktop app; the same login works in a normal browserYour own native app starts the sign-in in a WebViewFix
    2. 2Sign-in fails only when the link is opened from a messaging, social or other app's built-in browserYour web page is opened inside another app's embedded browserFix

What does the error look like?

  • disallowed_useragent

Cause 1 of 2

Your own native app starts the sign-in in a WebView

1Check

Search the app for the component that loads the authorization URL, such as WKWebView on iOS or a WebView on Android. Google disallows OAuth requests to its servers from embedded user-agents that the developer controls.

# iOS project
grep -R "WKWebView" --include=*.swift .
# Android project
grep -R "WebView" --include=*.kt --include=*.java .

2Fix

Use the system browser for the authorization request. On iOS use Google Sign-In or AppAuth, on desktop open the system browser with a local loopback redirect, and on mobile an in-app browser tab (SFSafariViewController or Chrome Custom Tabs) is accepted.

# Desktop (loopback): the app starts a listener on a random free port,
# opens the system browser to the authorization URL, and sets
# redirect_uri to http://127.0.0.1:<port>

3Verify

Sign in from the app: the Google account chooser now opens in the browser or tab and returns to the app.

# Manual check: complete one sign-in on a clean install

Confirmed by developers.google.com

Did this fix it?

Cause 2 of 2

Your web page is opened inside another app's embedded browser

1Check

A web login page is not itself the problem. When a user taps your link inside an iOS or macOS app that opens it in an embedded browser, Google still sees an embedded user-agent. Check from which app the failing users arrive.

# Log the User-Agent header on your login route and compare failing and working sessions

2Fix

Tell the user to open the page in the default browser, and when you control the linking app, open links with the OS default handler or SFSafariViewController instead of a web view.

<!-- Shown when the page detects an in-app browser -->
<p>Open this page in Safari or Chrome to sign in with Google.</p>

3Verify

Open the same link in the system browser and sign in.

# Manual check: sign in again from Safari or Chrome

Confirmed by developers.google.com

Did this fix it?

How do I stop it coming back?

  • Never put an OAuth authorization URL inside a WebView you control; use the system browser or AppAuth.
  • Test every sign-in flow on a real device from a clean install before release.
  • If you share login links in messages, add a line telling people to open them in their default browser.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Web apps

tsconfig rejects allowImportingTsExtensions

An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly

allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.