-
So I've got a problem where my session is starting out valid and authenticated which leads to my things hidden to the unauth'ed client being shown briefly. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
@boopxyz Are you using the next-auth/react components? |
Beta Was this translation helpful? Give feedback.
-
I think the best way would be to use the middleware to match your protected routes and redirect to your login url based on if the token from next auth exists or not. That way, if the user isn't authenticated, it will redirect to the login page from the middleware before it even gets to the protected routes. |
Beta Was this translation helpful? Give feedback.
-
Still having problems with this. Any help with be great! |
Beta Was this translation helpful? Give feedback.
This doesn't look right.
Why don't you pass it this way from your async layout component or whereever