-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot return custom error to the client side in the Next-Auth v5 Credentials Auth #11190
Comments
Hi, I'm facing the same problem. I found this temporary solution that may be helpful: #9900 (comment). |
The same issue is being discussed here in detail. I might also tell you that there is a way to check for some error but that also seems to broken currently In previous versions you could do something like this:
The issue with this approach that you do not know if the error is related to credentials like invalid email or something like database connection timeout |
Is there a way to throw a custom error message from the |
I read somewhere one should be able to throw a new Error with a custom code property (e.g. |
|
#11074 (comment) Follow here for discussions. |
#11074 (comment) Please follow this issue for details |
This is how i was able to revolve this In create a class that extend the
then in your credential provider you can use it like
with this, you can catch the error in your signin api route and also your client signin component |
I was able to fix this problem check out in discussions #8999 (comment) |
Fixed in #11469 |
Provider type
Credentials
Environment
Reproduction URL
https://github.com/dsmabulage/inventes
Describe the issue
I'm trying to implement the email, password login in the next app using next-auth v5.
In the NextAuth function inside authorize, I tried various methods to throw a custom error message that can passed to the user to show what's going wrong with the credentials.
How to reproduce
Expected behavior
I want to get that error message to the client side and show that error message to the user.
The text was updated successfully, but these errors were encountered: