redirect after sign up, emailAndPassword

await signIn.email(
{
email,
password,
callbackURL: "/admin",
}
await signIn.email(
{
email,
password,
callbackURL: "/admin",
}
can I redirect the user based on role? if it is a normal user, redirect to '/dashboard', if it is an admin '/admin'. How do you guys handle this?
1 Reply
Ping
Ping4w ago
You will have to write code to do this, so remove the callbackURL. Inside the SignIn.email, you can pass a 2nd argument, so pass an object and use the onSuccess callback method. From there, you'll need to run getSession to get the full user object to determine the role, then redirect based on roles

Did you find this page helpful?