© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago
momo

Intermittent 'code challenge does not match' in Flutter Deep Link Auth (PKCE)

Hi Supabase Community,

I'm facing a persistent AuthApiException: code challenge does not match previously saved code verifier error in my Flutter app's email verification deep link flow. This prevents automatic user login.

Crucially:

My colleague uses the exact same code and setup and successfully auto-logs in every time.

I have also seen it work successfully on my machine in the past, but it's now consistently failing.
This suggests an intermittent environmental/state issue, not a code bug.

My Setup Highlights:

supabase_flutter: ^2.9.0 (latest)

Deep Link Activation: App launches correctly via shu-dong://callback/register?code=... (verified in logs). The code is received.

Key Supabase.initialize params:

authFlowType: AuthFlowType.pkce

redirectTo: 'shu-dong://callback/' (within AuthClientOptions / auth)

localStorage: SupabaseLocalStorage()

Native: AndroidManifest.xml correctly configured for shu-dong://callback/.

Logic: /register route calls supabase.auth.exchangeCodeForSession(code).

Backend Logs: POST /auth/v1/token shows 400 Bad Request with x_sb_error_code: "bad_code_verifier".

Troubleshooting: I've performed thorough cleaning (flutter clean, pub cache repair, adb pm clear) and tested with new users.

Could this intermittency be due to a subtle network issue, device/emulator state, or a caching problem beyond standard cleaning? Any insights into diagnosing this intermittent code challenge mismatch would be greatly appreciated!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

OAuth Authentication: 'code challenge does not match previously saved code verifier' Error
SupabaseSSupabase / help-and-questions
6mo ago
Intermittent Auth fail by Magic Link
SupabaseSSupabase / help-and-questions
4y ago
Help: Mobile Reset Password Deep Link Not Triggering in Flutter (Web Works Fine)
SupabaseSSupabase / help-and-questions
8mo ago
Failed to start session: pkce(Auth.AuthError.PKCEFailureReason.invalidPKCEFlowURL)
SupabaseSSupabase / help-and-questions
6mo ago