© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
Matt

Auth redirects to protected route

Looking for some help and advice for handling initial Auth provider login. I am building a next JS 13 application using the app directory with supabase as authentication. I am using middleware to check if a client has the “supabase-login-token” cookie and that determines whether they should be on a page or not and then redirecting them if they are not logged in. The problem that I am having is that the path I redirect them to, after signing in with Google is one of the paths that is protected. So when the user gets redirected there from the authentication, the cookie takes a second or two to show up and the middleware redirects them because back to the login page. Any ideas would be appreciated. Thanks!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Supabase UI Social Auth not redirecting to protected route
SupabaseSSupabase / help-and-questions
2w ago
Auth and protected pages
SupabaseSSupabase / help-and-questions
6mo ago
Sveltekit protected routes question
SupabaseSSupabase / help-and-questions
6mo ago
Next JS Protected Routes
SupabaseSSupabase / help-and-questions
4y ago