You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Credentials provider to send signin credientials to our backend service.
If anything goes wrong, backend API is giving me error data. I couldn't find a way to pass this error data to client.
I have tested two ways:
Throwing error inside authorize
Throwing error inside signIn callback
But none worked.
Here is a simplified version of authOptions passed to NextAuth using first option:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Credentials provider to send signin credientials to our backend service.
If anything goes wrong, backend API is giving me error data. I couldn't find a way to pass this error data to client.
I have tested two ways:
authorize
signIn
callbackBut none worked.
Here is a simplified version of
authOptions
passed toNextAuth
using first option:Here is a simplified version of
authOptions
passed toNextAuth
using second option:Here is a simplified version of my
onSubmit
function:In both cases,
res.error
inonSubmit
is giving me built-in errors of NextAuth but I need the error message returned from backend API.I'm using version
5.0.0-beta.25
. I found this post which seems to be working in v4.So is there any way to handle this?
Any help would be appreciated. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions