Replies: 3 comments 2 replies
-
The pattern we've been using in our examples is to check for a valid user at the top of a Server Component, and immediately redirect if one isn't found. (See the final step in our Next.js guide.) Does this work for your use case? |
Beta Was this translation helpful? Give feedback.
-
@charislam If you are talking about this snippet, then it requires explicit code to be written on all |
Beta Was this translation helpful? Give feedback.
-
@sayem314 what did you do to solve your problem? I am facing the same situation. |
Beta Was this translation helpful? Give feedback.
-
Environment
14.1.0
0.1.0
Description
I'm currently working on implementing route protection and automatic redirection in my Next.js project using
@supabase/ssr
. Although I've managed to handle cookies within middleware for my dashboard group routes, I'm facing a challenge when it comes to protecting these routes and redirecting based on the authentication state.Expected Behavior
Current Behavior
Project Structure
Additional Context
Any guidance or recommendations on how to implement this functionality with
@supabase/ssr
would be greatly appreciated.Beta Was this translation helpful? Give feedback.
All reactions