When calling signin() / signout() methods from client side, the callback url is hardcoded to window.location.
It would be great if we could define a custom callback url to redirect the user to another route once signed in/out.
Usecases:
Currently the signin() method allows us to pass a provider id, maybe we could also pass an optional parameter like { callbackUrl }?
Thanks for thinking this through. Being able to specify the callbackURL like that as an option to both signin() and signout() sounds like the perfect way to support this!
I'm not 100% sure if signout supports callback URL, but if it doesn't, it should.
+1 good idea we should do this
PS: You can currently provide callbackUrl as a query param to sign in pages:
e.g.
/api/auth/signin?callbackUrl=/some/url/api/auth/signin/google?callbackUrl=/some/url/api/auth/signin/email?callbackUrl=/some/url(etc)
You probably know this, but fully agree it should be possible to do it from the signin() function too - the point of it is supposed to be to make things easier.
I am not 100% sure about sign out flow without checking (but it is supposed to work that way).
What if I'm using the signin method from next-auth/client?
What if I'm using the
signinmethod fromnext-auth/client?
This issue is actually about adding support for just that.
The client methods don't support callbackUrl as an option yet, but it's a simple and reasonable request and one that will probably come quite soon.
Most helpful comment
This issue is actually about adding support for just that.
The client methods don't support
callbackUrlas an option yet, but it's a simple and reasonable request and one that will probably come quite soon.