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
barry
barry17mo ago
This isn’t a spoon feeding discord ☠️ Do some research on your own
lecookie
lecookieOP17mo ago
I did and could find an answer for my needs Why even respond then ?
barry
barry17mo ago
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
barry
barry17mo ago
Create T3 App
NextAuth.js 🚀 Create T3 App
The best way to start a full-stack, typesafe Next.js app.
barry
barry17mo ago
This is an example
Want results from more Discord servers?
Add your server