Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Is there a way on NextAuth to redirect upon login to a specific page based on session role? - Theo's Typesafe Cult
TTC
Theo's Typesafe Cult
•
4y 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 | NextAuth.js
Callbacks are asynchronous functions you can use to control what happens when an action is performed
.
Theo's Typesafe Cult
Join
26,564
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Using nextauth – custom login page
TTC
Theo's Typesafe Cult / questions
3y ago
what is the best way to redirect the user to login page in CSR?
TTC
Theo's Typesafe Cult / questions
4y ago
clean way to protect page and redirect
TTC
Theo's Typesafe Cult / questions
4y ago