Theo's Typesafe CultTTC
Theo's Typesafe Cult4y ago
8 replies
theFern

Is there a way on NextAuth to redirect upon login to a specific page based on session role?

E.g.
- If session.role === 'teacher', redirect to '/teacher/dashboard', else
- redirect to '/admin/dashboard'

The NextAuth docs don't show a way to redirect based on session data: https://next-auth.js.org/configuration/callbacks#redirect-callback
Callbacks are asynchronous functions you can use to control what happens when an action is performed.
Was this page helpful?