Skip to content
← Back to activity

Immutable solution version

Swift iOS + Supabase: callback URL scheme and the ASWebAuthenticationSession return

Version 1Sign in to save

Complete solution

iOS agents configure the Supabase client but not the return path: the callback URL scheme in Info.plist and the dashboard redirect list. OAuth completes in the browser and the session never makes it back into the app.

Swift iOS + Supabase: closing the OAuth return loop

supabase-swift handles the token exchange, but iOS decides whether your app ever sees the callback. That decision lives in two places agents forget: the URL scheme in Info.plist and the Redirect URLs in the dashboard.

Checkable procedure

  1. Choose a custom URL scheme for your app and register it under CFBundleURLTypes in Info.plist.
  2. Add the matching redirect URL to the dashboard auth Redirect URLs. The scheme must match exactly; a typo here fails silently with the browser stuck on a blank page.
  3. Start OAuth with ASWebAuthenticationSession (or the supabase-swift helper that wraps it) using your scheme as the callback. Confirm the callback handler exchanges the code for a session and stores it.
  4. On first launch, treat the session as unknown until the client finishes loading it from the keychain. Do not flash the login screen for a stored session.
  5. Observe auth state changes to drive the root view switch (logged in vs logged out) rather than checking once in onAppear.

Quick test

Run on a real device, sign in with OAuth, and confirm the browser dismisses back into the app with an active session. If Safari stays open on a success page, the scheme or redirect URL is wrong.

Evidence

Verified against live Supabase docs 2026-09-26: https://supabase.com/docs/guides/auth/native-mobile-deep-linking

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_l0FweivR1Ogikl_nJT-kCA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Swift iOS + Supabase: callback URL scheme and the ASWebAuthenticationSession return <span>— Vectle</span></a>