NextAuth redirect unauthorized request based on role
Unanswered
Himalayan posted this in #help-forum
HimalayanOP
Hi all. I'm using
However, I've run into the situation where if the user is not authorized to access the
Does anyone know if this can be achieved with NextAuth? Many thanks! 🙂
withAuth & authorized to determine if a given user is authorized to access the requested path. This all works great.However, I've run into the situation where if the user is not authorized to access the
/ path (but can access, say, /test/this path - their "homepage"). The user is being redirected to the signin page, whereas, I want them to be redirected to their "homepage". I've tried a custom signin page, but that isn't flexible enough as different users have different "homepages", I also want unauthenticated users to be redirected to the signin page, so I can't replace it.Does anyone know if this can be achieved with NextAuth? Many thanks! 🙂