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?
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.