Signin in turborepo t3

I'm running a t3 turborepo that has 2 apps, 1 admin (CMS) and the client next app. The login is done using credentials, how can I do so that when you login in the admin app you get redirected to localhost:3001/ (admin), and when you login in the client app you get redirected to localhost:3000/? Currently when I login in admin I get redirected to the client /
5 Replies
Ambushfall
Ambushfall2y ago
Authorization filtration. Check context of the signed in user and forward him to the correct route.
hyperzone
hyperzone2y ago
Yeah but an Admin can also log in to the client app like a normal user
Ambushfall
Ambushfall2y ago
I'm afraid you're not understanding my point. Authentication and Authorization are two different things, hence there's no reason for NextAuth to be tagged. Upon Auth, check the authority of your user and Provide him content based on what you wish. It's up to you to authorize and filtrate content of roles, or different databases. It's not an Auth question for all intents and purposes. Do keep in mind it's possible to separate Auth and Authorization for each of the respective apps as well. The answer to the question would be routing each app to it's respective route and using middleware.
hyperzone
hyperzone2y ago
NextAuth automatically redirects you, so my question was how to override that, preferably using NextAuth. I'm not asking about auth or authorization in the create-t3-turbo your auth is defined in a package because it's a turborepo, so both apps use the same nextauth config
Ambushfall
Ambushfall2y ago
Did you check official Next Auth Callbacks documentation?
Want results from more Discord servers?
Add your server