App Store
Google sign-in fails in my Capacitor app (disallowed_useragent): how to move it to the system browser and come back with a deep link
Google blocks its sign-in page inside embedded web views, which is what a Capacitor app is, so the web login either fails with disallowed_useragent or escapes to Safari and never comes back. The fix is to open Google sign-in in an in-app system browser, send the user back to the app with a deep link that Supabase allows, and finish the login inside the app. It takes a few small changes in your code, in Xcode and in the Supabase dashboard.
What you are seeing
Sign in with Google works on your website. In the iPhone build of the same app, wrapped with Capacitor, it breaks in one of two ways:
- Google shows an error page inside the app instead of the account picker, and the error details say
disallowed_useragent. Google's OAuth for native apps documentation describes this error as the authorization page being shown "inside an embedded user-agent disallowed by Google's OAuth 2.0 Policies". - Tapping the Google button throws the user out of the app into Safari. They sign in there, and end up on your website in Safari, signed in, while the app itself stays on the login screen.
Both are the same problem seen from two sides. It usually shows up late, because during development you test sign-in in a desktop browser, where it works.
How to check it yourself
Everything below runs on your own project: the repository, the Xcode project and your Supabase dashboard.
1. Find out how the app starts the Google login
In the folder of your web app, search for the sign-in call and for any use of the Capacitor Browser and App plugins:
grep -rn "signInWithOAuth" src
grep -rn "@capacitor/browser\|@capacitor/app\|appUrlOpen" src package.jsonsignInWithOAuth is called without skipBrowserRedirect and nothing listens for appUrlOpen, the app has no way to receive the login result. It is the web flow running unchanged inside the app.2. Check the Capacitor config for settings that load Google inside the app
Open capacitor.config.ts (or capacitor.config.json) and look for server.url and server.allowNavigation. Capacitor's config reference says that by default external URLs open in the external browser, not the web view, and that allowNavigation adds URLs the web view may navigate to. If Google or Supabase domains (or a wildcard) are listed there, the Google page loads inside the web view and Google answers with disallowed_useragent. If nothing is listed, the login opens in Safari - the second symptom above. Capacitor marks both server.url and allowNavigation as "not intended for use in production".
3. Check whether the app has a URL scheme it can be opened with
In Xcode, open the App target, go to the Info tab and look under URL Types, or search ios/App/App/Info.plist for CFBundleURLSchemes. No entry means no deep link can bring the user back into the app. To test a scheme you have registered, run the app in the iOS Simulator and open a link to it from the Mac's terminal:
xcrun simctl openurl booted "com.yourcompany.yourapp://login-callback?code=test"4. Check the Supabase redirect allow list
In the Supabase dashboard, open Authentication, then URL Configuration. The Site URL is the default place users are sent after login when the app does not ask for a specific one (Supabase redirect URLs). The app's deep link (for example com.yourcompany.yourapp://login-callback) has to be in Redirect URLs. If only your website is there, the login finishes on your website.
5. See whether anyone has signed in with Google from the app
In the Supabase SQL Editor, this read-only query shows the most recent Google sign-ins (Supabase identities). Try Google sign-in on the phone, then run it again:
select i.email, i.last_sign_in_at, u.last_sign_in_at as user_last_sign_in_at
from auth.identities i
join auth.users u on u.id = i.user_id
where i.provider = 'google'
order by i.last_sign_in_at desc nulls last
limit 10;last_sign_in_at after your test, while the app is still logged out, means Google and Supabase did their part and the session went to Safari instead of the app. No fresh row means the login stopped earlier, at Google's error page.Why it happens
A Capacitor app shows your web app inside WKWebView, Apple's embedded web view. Since 2021 Google has refused OAuth sign-in in embedded web views. Its announcement names WKWebView (and the older UIWebView) on iOS and Android WebView as non-compliant, says they were blocked from September 30, 2021, and that such requests get the disallowed_useragent error. Google's reasoning is security: in an embedded web view, the app around the page could read or alter what the user types.
The web version of signInWithOAuth sends the whole page to Google and expects Google, then Supabase, to send it back to your website. Inside the app that breaks at one of two points:
- The Google page is allowed to load inside the web view: Google blocks it.
- The Google page is opened outside the app, in Safari: the login succeeds, but Supabase sends the result to the Site URL, your website, and the app never hears about it. Even when it reaches the app, the app has to turn the result into a session itself.
So the app needs three things the web version does not: a browser Google accepts, a way back into the app (a deep link), and code that finishes the login when the app is opened by that link.
How to fix it
This uses Capacitor's Browser plugin, which on iOS opens pages in SFSafariViewController - an in-app Safari window that Google lists as a supported option (OAuth for native apps) - and the App plugin, which tells your code when the app is opened by a link. The login result comes back as a one-time code that the app exchanges for a session (Supabase PKCE flow).
1. Pick a deep link and register it in the app
Choose a URL scheme unique to your app, usually your bundle identifier, for example com.yourcompany.yourapp. The full return address will be com.yourcompany.yourapp://login-callback. Register the scheme in ios/App/App/Info.plist (or in Xcode under Info, URL Types), as the App plugin docs show:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.yourcompany.yourapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.yourcompany.yourapp</string>
</array>
</dict>
</array><dict> of Info.plist. The AppDelegate.swift that Capacitor 8 generates already passes opened links to Capacitor through ApplicationDelegateProxy (template); if that file was edited, make sure the call is still there.On Android, register the same scheme in android/app/src/main/AndroidManifest.xml. The Capacitor 8 Android template gives MainActivity only the launcher intent filter (template manifest), so without this step the deep link never opens the Android app and appUrlOpen never fires. Add a second filter inside the MainActivity <activity>:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/custom_url_scheme" />
</intent-filter>custom_url_scheme in android/app/src/main/res/values/strings.xml to your scheme, for example com.yourcompany.yourapp. The template already defines that string (strings.xml), but nothing in the manifest uses it until you add this filter.2. Allow the deep link in Supabase
- In the Supabase dashboard open Authentication, then URL Configuration.
- Under Redirect URLs, add
com.yourcompany.yourapp://login-callback. Supabase's redirect URL docs use the same pattern, for examplecom.supabase://login-callback/, and recommend exact paths rather than wildcards in production. - Leave the Site URL pointing at your website, so web sign-in keeps working.
- In Google Cloud Console nothing changes: the authorized redirect URI stays the Supabase callback shown on the Google provider page in Supabase (Supabase: Login with Google). Google sends the user to Supabase, and Supabase sends them to your app.
3. Install the plugins and switch the Supabase client to PKCE
npm install @capacitor/browser @capacitor/app
npx cap syncimport { createClient } from "@supabase/supabase-js";
export const supabase = createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY, {
auth: { flowType: "pkce" },
});flowType: "pkce" makes the login return a ?code= that the app exchanges for a session (PKCE flow). Keep your existing URL and key variables.4. Open Google sign-in in the system browser
import { Capacitor } from "@capacitor/core";
import { Browser } from "@capacitor/browser";
import { supabase } from "./supabase";
export const APP_REDIRECT = "com.yourcompany.yourapp://login-callback";
export async function signInWithGoogle(): Promise<void> {
if (!Capacitor.isNativePlatform()) {
// Website: keep the normal redirect flow.
const { error } = await supabase.auth.signInWithOAuth({
provider: "google",
options: { redirectTo: window.location.origin },
});
if (error) throw error;
return;
}
// iPhone or Android app: get the Google URL without leaving the app...
const { data, error } = await supabase.auth.signInWithOAuth({
provider: "google",
options: { redirectTo: APP_REDIRECT, skipBrowserRedirect: true },
});
if (error) throw error;
if (!data.url) throw new Error("Supabase did not return a sign-in URL.");
// ...and open it in the in-app system browser, which Google accepts.
await Browser.open({ url: data.url });
}skipBrowserRedirect: true returns the URL instead of navigating the web view to it (signInWithOAuth). Capacitor.isNativePlatform() is true in the iOS and Android app and false on the website (Capacitor web API).5. Finish the login when the deep link opens the app
import { App } from "@capacitor/app";
import { Browser } from "@capacitor/browser";
import { supabase } from "./supabase";
import { APP_REDIRECT } from "./signInWithGoogle";
// Register once, when the app starts (for example in main.tsx).
App.addListener("appUrlOpen", async ({ url }) => {
if (!url.startsWith(APP_REDIRECT)) return; // some other link, not ours
await Browser.close().catch(() => undefined); // the window may already be closed
const link = new URL(url);
const errorText =
link.searchParams.get("error_description") ??
new URLSearchParams(link.hash.slice(1)).get("error_description");
if (errorText) {
showLoginError(errorText); // your own UI message
return;
}
const code = link.searchParams.get("code");
if (!code) {
showLoginError("Sign-in did not complete. Please try again.");
return;
}
const { error } = await supabase.auth.exchangeCodeForSession(code);
if (error) showLoginError(error.message);
// On success, onAuthStateChange fires and the app shows the signed-in screen.
});appUrlOpen fires for custom scheme links and for Universal Links (App plugin). The code is valid for 5 minutes, can be used once, and must be exchanged on the device where the login started (PKCE flow) - which is the case here, because the app started it. Supabase reports errors in the URL, so both the query and the fragment are checked.6. Remove the workarounds and rebuild
- Remove Google and Supabase domains from
server.allowNavigation, and do not shipserver.url(Capacitor config). - Do not try to get past the error by changing the web view's user agent (
overrideUserAgent) to look like Safari. The request still comes from an embedded web view, which is exactly what Google's policy prohibits (Google Developers Blog). - Run
npm run build && npx cap sync, then test on a real iPhone: Google button, account picker, return to the app, signed-in screen. Then sign out and repeat, and try cancelling halfway.
https link to a domain you own) for iOS, which need an apple-app-site-association file on your domain and the Associated Domains capability in Xcode (Capacitor deep links). The appUrlOpen handler above works for both. A different route is native Google sign-in, which gets an ID token without a browser and passes it to Supabase's signInWithIdToken; Supabase documents it for iOS, Android and Expo, and in a Capacitor app it needs a community plugin.When to get help
- The browser opens and Google works, but the app never receives the link, or receives it and the session does not stick.
- Sign-in works in the Simulator but not on a real iPhone, or works on iOS and not on Android.
- Your app also needs Sign in with Apple and account deletion before submission, and you want the login set up once, properly.
- You have a submission date and cannot afford a rejection cycle over login.
Sources
Primary documentation this guide was checked against. Platforms change - if something here no longer matches, the source wins.
- OAuth in embedded webviews (disallowed_useragent)Google Developers Blog
- OAuth 2.0 for mobile and desktop appsGoogle for Developers
- Configuration (server.url, allowNavigation)Capacitor docs
- Browser pluginCapacitor docs
- App plugin (appUrlOpen, URL schemes)Capacitor docs
- Deep linksCapacitor docs
- Capacitor web API (isNativePlatform)Capacitor docs
- iOS template AppDelegate.swift (8.x)Capacitor on GitHub
- Android template AndroidManifest.xml (8.x)Capacitor on GitHub
- Redirect URLsSupabase docs
- Native mobile deep linkingSupabase docs
- PKCE flowSupabase docs
- signInWithOAuthSupabase docs
- Login with GoogleSupabase docs
- IdentitiesSupabase docs
- App Store Review Guidelines (last updated 2026-10-16)Apple Developer
Frequently asked questions
- What does disallowed_useragent mean?
- It is Google's error for a sign-in request made from an embedded web view, such as the WKWebView inside a Capacitor app. Google has blocked these since September 30, 2021. The fix is to open the sign-in in a browser Google accepts, such as the in-app Safari window the Capacitor Browser plugin opens, and return to the app with a deep link.
- Why does Google sign-in work on my website but not in the app?
- On the website the login runs in a real browser. In the app it runs inside a web view, which Google blocks, or it jumps to Safari and finishes on your website instead of in the app. The app needs its own return address (a deep link) and code that finishes the login when that link opens it.
- Can I fix it by changing the user agent?
- No. Changing what the web view reports about itself does not change that it is an embedded web view, which Google's policy prohibits. Open the sign-in in the system browser instead.
- Do I need to change anything in Google Cloud Console?
- Not for the browser-and-deep-link fix. Google still redirects to your Supabase project's callback URL. What changes is the Supabase Redirect URLs list, where the app's deep link has to be added. Native Google sign-in without a browser is different: it needs an iOS client ID in Google Cloud and in the Supabase Google provider settings.
- Does this also fix Sign in with Apple and other providers?
- The same pattern - system browser, deep link, code exchange - works for other OAuth providers in Supabase. Whether you must offer Sign in with Apple at all is a separate App Store question under Guideline 4.8.
Related guides
Fixed-price audit
Want someone to check the whole app, not just this?
A review of data security, production readiness and App Store readiness for apps built with AI tools. 900 USD, a ranked list of fixes within 5 business days.