© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
2 replies
definitelynotshourya

Local Supabase OAuth Error

{"code":400,"msg":"OAuth state is invalid: signature is invalid"}
{"code":400,"msg":"OAuth state is invalid: signature is invalid"}


I am running supabase locally, while trying to login through google, this is the error.


I have a hunch from where the error might have surfaced.

I have passed a
redirectTo
redirectTo
query param in my callback:
http://localhost:54321/auth/v1/authorize?provider=google&redirect_to=http://localhost:3000/auth/callback?redirectTo=%2Fworkspace&...
http://localhost:54321/auth/v1/authorize?provider=google&redirect_to=http://localhost:3000/auth/callback?redirectTo=%2Fworkspace&...


Can this be causing the error? As I have noticed that as soon as I did this, this error has started coming. My intension is to redirect the user back to the page which the user had originally requested while being logged out.

This is my redirect URL:
// generally redirectTo contains values such as '/workspace' or '/workspace/
const redirectUrl = `${new URL(req.url).origin}/auth/callback${
    redirectToParam ? `?redirectTo=${encodeURIComponent(redirectToParam)}` : ""
  }${detailsParam ? `&details=${detailsParam}` : ""}`;
// generally redirectTo contains values such as '/workspace' or '/workspace/
const redirectUrl = `${new URL(req.url).origin}/auth/callback${
    redirectToParam ? `?redirectTo=${encodeURIComponent(redirectToParam)}` : ""
  }${detailsParam ? `&details=${detailsParam}` : ""}`;
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

Google OAuth "Bad request" error on local development with Supabase CLI
SupabaseSSupabase / help-and-questions
8mo ago
Local Supabase Setup
SupabaseSSupabase / help-and-questions
4mo ago
Supabase CLI Local
SupabaseSSupabase / help-and-questions
6mo ago
Supabase Local Setup
SupabaseSSupabase / help-and-questions
6mo ago