How to redirect users, when using auth.js default signIn page (api/auth/signin)
Answered
Macao paper wasp posted this in #help-forum
Macao paper waspOP
Hello! My problem is that I don't know how can I redirect the users after a signIn is made from the default signIn page of auth.js, so by calling /api/auth/signin
Thanks for your answers!
Thanks for your answers!
8 Replies
@Macao paper wasp Hello! My problem is that I don't know how can I redirect the users after a signIn is made from the default signIn page of auth.js, so by calling /api/auth/signin
Thanks for your answers!
do you have a
if yes, you can use
* next-auth v4:
* authjs/next-auth v5 beta:
signIn() call somewhere (like onClick of a button, for example)?if yes, you can use
* next-auth v4:
callbackUrl (https://next-auth.js.org/getting-started/client#specifying-a-callbackurl).* authjs/next-auth v5 beta:
redirectTo (https://authjs.dev/getting-started/session-management/login).Macao paper waspOP
This is my solution, I'm a beginner, should I change this scheme, to call a signIn function instead?
@Macao paper wasp This is my solution, I'm a beginner, should I change this scheme, to call a signIn function instead?
iirc you can use it like this
/api/auth/signin?callbackUrl=/adminAnswer
Macao paper waspOP
Works smoothly, thank you very much!
Can I have another question, please?
yes, though please create a new post. it's late here so i'll go sleep, but other people may come and help
Macao paper waspOP
Sure, thank you!
Macao paper waspOP
@joulev please can you help with my other tickets? Thanks a lot