Nextjs auth-helpers with middleware and magiclinks
I'm working on getting the official auth-helpers library working with NextJS and magiclinks, but hitting an issue. When the user is redirected back to the app, it'll authenticate with supabase and then return them to their original destination. Unfortunately, the session isn't set by the time it hits the middleware, so it'll push them back to the login page and then immediately authenticate them client-side on that page.
How can I get the middleware to recognize that the user is now authenticated after clicking on an emailed magic link?
Here's an example of how the middleware is configured. I don't have the email check, but the rest is the same: https://supabase.com/docs/guides/auth/auth-helpers/nextjs#auth-with-nextjs-middleware
How can I get the middleware to recognize that the user is now authenticated after clicking on an emailed magic link?
Here's an example of how the middleware is configured. I don't have the email check, but the rest is the same: https://supabase.com/docs/guides/auth/auth-helpers/nextjs#auth-with-nextjs-middleware
Supabase Auth with Next.js
Authentication helpers for Next.js API routes, middleware, and SSR.