The auth flow that works for one person
You asked Cursor to add authentication. It generated a Supabase Auth setup with email/password and OAuth providers. You tested it. It worked. You deployed.
Then the support emails start:
I cant log in on my iPhone
The magic link never arrives
I was logged out at 3 AM and couldnt get back in
Sign in with Apple just spins
Your auth flow works for you. It does not work for your users.
Why AI gets auth wrong
AI coding assistants optimise for the happy path. They generate code that works when:
The browser accepts third-party cookies
The redirect URI matches exactly
The refresh token is still valid
The OAuth popup isnt blocked
The user completes the flow in one sitting
Real users bring none of those guarantees. They bring Safari Intelligent Tracking Prevention, corporate firewalls that block OAuth popups, expired refresh tokens after weekends, and sign in with Apple edge cases the documentation barely mentions.
The AI does not know this. It only knows the pattern from training data: here is how you initialize Supabase Auth.
The five auth failures that reach production
1. Refresh tokens that die in the background
Supabase issues a refresh token with the access token. The access token expires in an hour. The refresh token expires in 30 days but only if it gets used. If a user closes the app on Friday and opens it Monday, the refresh token may have rotated and the old one is invalid.
AI-generated code often assumes the refresh token just works. It does not handle:
Automatic token refresh on app wake
Graceful fallback when refresh fails
Clearing stale tokens and forcing re-authentication
Test this: Background the app for 25 hours. Open it. Does it silently refresh, or does the user see a blank screen?
2. Safari and the third-party cookie wall
Safari Intelligent Tracking Prevention blocks third-party cookies by default. If your Supabase project uses a custom domain for auth (auth.yourapp.com) but your app runs on app.yourapp.com, the auth cookies are third-party. Safari blocks them. The user gets a login loop.
AI tools rarely configure the custom domain correctly for cookie sharing. They also rarely set SameSite: None; Secure on the auth cookies.
Test this: Open your deployed app in Safari on iOS. Log in. Close the tab. Reopen. Are you still logged in?
3. OAuth popups that never open
Corporate firewalls, browser extensions, and mobile browsers block window.open for OAuth. AI-generated auth flows almost always use popup-based OAuth because it is simpler in the tutorial.
When the popup blocks, the user sees nothing. No error. No fallback. Just a button that does nothing.
Test this: Disable popups in your browser. Click Sign in with Google. What happens?
4. Redirect URIs that mismatch in production
Supabase requires the redirect URI in the provider console to match exactly what your app sends. AI tools generate http://localhost:3000/auth/callback for development. You change it to https://yourapp.com/auth/callback for production. But the provider console still has the old one, or the staging URL, or a trailing slash mismatch.
The result: Invalid redirect URI errors that only appear in production.
Test this: Check every provider console (Google, GitHub, Apple) against every deployed environment (staging, preview, production).
5. Magic links that expire or land in spam
Email magic links are convenient. They are also fragile. The token expires (default 1 hour in Supabase). Corporate email filters rewrite links. Users click the link on a different device than they opened the email.
AI-generated flows rarely handle:
Token expiry with a friendly message
Cross-device link opening (the session must bind to the browser that clicks)
Resend logic with rate limiting
Test this: Request a magic link. Wait 90 minutes. Click it. What does the user see?
A practical auth audit you can run today
You do not need a security expert to catch these. You need a checklist and a second browser.
Test in Safari on iOS not Chrome DevTools device mode. Real Safari.
Test with third-party cookies blocked Safari default, Firefox strict, Brave shields up.
Test with popups blocked browser setting, not extension.
Background the app for 24 hours then reopen and verify silent refresh.
Click every OAuth provider Google, GitHub, Apple in every deployed environment.
Request a magic link, wait, click verify the expiry handling.
Check the Network tab look for Set-Cookie headers on auth responses. Are they Secure? SameSite: Lax or None?
If any of these fail, your auth is not production-ready.
What the free surface check catches
The free surface check scans your public headers and cookies. It will flag missing security headers (Strict-Transport-Security, Content-Security-Policy) and cookies that lack Secure or SameSite attributes. These are the same headers that break auth in Safari and leak session data.
It does not test your auth flow. It only sees what the browser sees before login.
What the launch-readiness audit covers
The launch-readiness audit includes a full Login and permissions area (14 checks). It verifies:
Refresh token rotation and fallback handling
OAuth redirect URI configuration across environments
Magic link expiry and cross-device behaviour
Cookie attributes on every auth-relevant endpoint
Whether one customer can access another customers data after login
A developer confirms every finding. You get a launch-readiness score and a must-fix list with the file, line, or setting for each issue.
Ship auth that survives real users
Your AI built the happy path. The gaps above are not edge cases they are the default experience for a portion of your users. Run the seven tests. Fix what breaks. Then you can launch knowing the front door actually works.
If you would rather a developer run the full 137-point audit, the launch-readiness audit starts at 450 for founding customers and includes a kick-off call and a walkthrough of every finding.