SupabaseS
Supabase2w ago
Nine

React Router V7 App Authentication Fix

I solved the issue regarding auth with rr7 when it gives you back: invalid request: both auth code and code verifier should be non-empty which is if you follow the guide on the Auth UI supabase site

The fix is to pass in the headers into the redirect on login as follows
const { supabase, headers } = createClient(request);

if (data.url) {
return redirect(data.url, { headers });
}

This will be enough, I already opened up a PR to get it updated in the docs

https://github.com/supabase/supabase/pull/41157
GitHub
What kind of change does this PR introduce?
Docs update
What is the current behavior?
Without passing the headers in the request we would get the following error:
invalid request: both auth code an...
Was this page helpful?