When authorize function inside the CredentialsProvider throws an error, the client side still receives ok status
The problem is outlined as in the NextAuth Issues
Fix
Instead of checking the status by then and catch, I checked the error message of the API response.
const res = await signIn('credentials', { ... // send the data}if (res?.error) { ... // do something }
Issue
authorize
function inside theCredentialsProvider
throws an error, the client side still receivesok
status The problem is outlined as in the NextAuth IssuesFix
Instead of checking the status by
then
andcatch
, I checked the error message of the API response.const res = await signIn('credentials', { ... // send the data}
if (res?.error) { ... // do something }