This one cost us two days.

The symptom

Supabase auth works perfectly on web and Android. On iOS, users tap "Sign in with Google" and... nothing happens. No error. No callback. The WebView just sits there.

The root cause

iOS WKWebView has strict security policies around cross-origin redirects. The standard OAuth flow redirects to Supabase's callback URL, which then redirects back to the app. iOS blocks the second redirect silently.

The fix: PKCE

PKCE (Proof Key for Code Exchange) changes the flow. Instead of relying on redirects, the client generates a code verifier, sends a code challenge to the auth provider, and exchanges the authorization code directly. No cross-origin redirect chain.

const { data, error } = await supabase.auth.signInWithOAuth({
  provider: "google",
  options: {
    skipBrowserRedirect: true,
    redirectTo: "mymuaythai://auth/callback",
    queryParams: {
      access_type: "offline",
      prompt: "consent",
    },
  },
});

The lesson

Always test auth flows on physical iOS devices, not just simulators. And if you're using Supabase Auth with React Native, enable PKCE from day one — don't wait until you discover the silent failure in production.

Share this article

X LinkedIn

Continue reading

Your AI-built product works. What breaks in production

What AI-generated code hides in production — secrets, data layer, EU AI Act exposure. Production Readiness Audit €3,500 · free 30-min call.

A Client Rebuilt My AML System in a Weekend. Here's What Both Codebases Actually Look Like.

A client rebuilt my AML screening system with AI in a weekend. I audited both codebases. Here's what the rebuild missed — and why it matters.

Why Your LLM App Needs a Graph

Stateless chatbots are a dead end. Here is how I am using graph-based architectures to build reliable AI agents that can actually reason.

← Back to all articles