Next.js Discord

Discord Forum

How to deny some user from navigating into a certain subtree.

Unanswered
hazamashoken posted this in #help-forum
Open in Discord
What are some available options? Assume that the group is store in the session using Next-Auth.

group can be check with
session.user.group !== "admin"


only admin should be able to access pages in
app/admin/...

this route guard should be implement on server side.

Answer: use put route guard in the subtree layout.tsx

0 Replies