SupabaseS
Supabase4y ago
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!
Was this page helpful?