return null in CredentialsProvider redirects to /api/auth/error #3244
Unanswered
zakaryan2004
asked this question in
Help
Replies: 1 comment
-
Nevermind, this is solved in beta.7. It's so amusing how many times one can spend fixing a problem, and then find the fix immediately after writing about the problem, especially to other people. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
According to the documentations, writing
return null
in theauthorize
callback of the CredentialsProvider should show the user this text: "Sign in failed. Check the details you provided are correct.". In v3, this is the case.But, in v4, if the authorize callback returns null, the user is then redirected to this URL:
http://localhost:3000/api/auth/error?error=CredentialsSignin?provider=credentials
Navigating to this URL shows the correct text in the intended way:
http://localhost:3000/api/auth/signin?error=CredentialsSignin?provider=credentials
How to test this:
next-auth-example
v4
branch and get it running.You can test the same thing with the
main
branch ofnext-auth-example
(with minor changes in provider), and notice this feature working correctly.I think this should be an Issue, but I made it a discussion as I may not be aware of changes made in v4 which achieve this in other ways. In any case, I think it should work the same way as it does on v3, without anything additional.
I have taken a small look at the source code but didn't find the root cause yet.
Beta Was this translation helpful? Give feedback.
All reactions