SupabaseS
Supabase2y ago
Budi

Issue with redirect using OAuth with local development

I'm building a SvelteKit app using Supabase SSR and am running a local version of Supabase for development. I have configured the env variables according to the Supabase docs, adding both the local site URL and redirect destionation in config.toml and my remote db in .env to get Supabase SSR working.

supabase/config.toml: https://github.com/brucey0x/bv_markdown_blog/blob/293ec43410db654d60882e540f1fc2fd2cad9f66/supabase/config.toml

I am triggering a Github login via a form action, which has the redirect url src/routes/auth/+page.server.ts: https://github.com/brucey0x/bv_markdown_blog/blob/293ec43410db654d60882e540f1fc2fd2cad9f66/src/routes/auth/%2Bpage.server.ts

The callback page has a server function defined as src/routes/auth/callback/+server.ts: https://github.com/brucey0x/bv_markdown_blog/blob/293ec43410db654d60882e540f1fc2fd2cad9f66/src/routes/auth/callback/%2Bserver.ts

Unfortunately, when I trigger the Github signin, I get this error log with a redirect URL that includes the public:

OAuth signin failed:  Redirect {
  status: 303,
  location: 'https://wwznwptvovjbqfyltnza.supabase.co/auth/v1/authorize?provider=github&redirect_to=http%3A%2F%2Flocalhost%3A5173%2Fauth%2Fcallback%3Fnext%3D%2Fadmin&code_challenge=[CODE_CHALLENGE]&code_challenge_method=s256'
}


I've done the obvious things like supabase stop && supabase start but can't figure out why it's including my public supabase URL in the url while ALSO including the local redirect.

The auth?/signin request works and returns a 204 success response. But the src/routes/auth/callback/+server.ts logs aren't trigerring so the page isn't being hit.

Any suggestions? Thank you!
Was this page helpful?