Nuxt & Supabase Auth
I've set up working authentication in my Nuxt 3 app. I have an authGuard middleware that I've set up which is super basic:
The thing is, I'm redirecting from '/login' to '/dashboard' but if I auth guard the dashboard, it immediately sends the user back to '/login' because the very first instant when the script runs, there is still no user registered.
How can I make sure that I wait until the Supabase does it's thing, registers that there is a suer, before checking for a user and redirecting if none is found?
5 Replies
I'm getting the distinct impression this is a Supabase problem. It has other issues like #NuxtLinks just stop working as well. I'm guessing it's just not "there yet"...
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It doesn't seem that auth login works on Static hosting. The login works, however the session does not stick or something..
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I don't have your exact problem but I have my supabase auth and guards working pretty good here https://github.com/JavascriptMick/nuxt3-boilerplate hth
GitHub
GitHub - JavascriptMick/nuxt3-boilerplate: Simple boilerplate for S...
Simple boilerplate for SAAS. Nuxt3, Supabase, OAuth, Prisma, TRPC, Pinia, Stripe - GitHub - JavascriptMick/nuxt3-boilerplate: Simple boilerplate for SAAS. Nuxt3, Supabase, OAuth, Prisma, TRPC, Pi...