How to handle a bad login error response with Sign In callback and a custom JWT credential provider #1563
-
Hi, I have been trying to deal with this without success. I'm using the credential provider with a custom backend and I'm trying to send an error when a user sends a bad password/email while trying to login. What I have done so far is trying to return an error in the sign In callback if the user.accessToken does not exist but I think it's only allowed to return a false boolean because if I return something else there is no error. What would be the proper way to handle this situation with crendentials? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
You probably want to check out the redirect: false option of the signIn client-side method https://next-auth.js.org/getting-started/client#using-the-redirect-false-option Just for extra info, the signin callback is supposed to return a boolean, or a string (an url to redirect to in case an error occurs for example) which will cancel the login flow if false or a string. |
Beta Was this translation helpful? Give feedback.
You probably want to check out the redirect: false option of the signIn client-side method https://next-auth.js.org/getting-started/client#using-the-redirect-false-option
Just for extra info, the signin callback is supposed to return a boolean, or a string (an url to redirect to in case an error occurs for example) which will cancel the login flow if false or a string.