Local Supabase OAuth Error

{"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 query param in my callback:
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}` : ""}`;
Was this page helpful?