Get Role and protected route
How could I let's say make an /admin route where if I am not authenticated it will redirect to directly the discord auth link and if I am it will check a db if the user has admin set to true. If yes it will then fetch another db for some data and return it. Please ping or dm when you respond
5 Replies
This isn’t a spoon feeding discord ☠️
Do some research on your own
I did and could find an answer for my needs
Why even respond then
?
This isn't a beginner discord man
But sure
If a user can have one role just have a role property on the user model
If a user can have many roles then you need a junction table
Then in the callbacks you can set with next auth include the role as shown in t3 app docs
This is an example