Supabase + Next.js: Sign Up and Magic Link Flow. Am I Doing This Right?
I’m using Supabase for authentication in my Next.js app and I want to confirm if I’m handling sign up confirmations + magic links correctly.
When I call signInWithOtp, I set:
On /api/auth/callback, I extract search params (code, access_token, refresh_token) and set the session manually:
2 Replies
Another problem is that sometimes Supabase puts tokens in the URL hash (#) instead of query params, which cannot be accessed on the server.
To cover that, I added client-side handling on the signin page:
Am I over complicating his by handling both cases manually, or is there another way to handle this?
You can refer to this example app https://github.com/silentworks/supabase-by-example/tree/main/nextjs