react-oidc-context
react-oidc-context copied to clipboard
Error handling when using signinResourceOwnerCredentials()
try {
const user = await auth.signinResourceOwnerCredentials({
username: values.email,
password: values.password,
})
console.log(user)
} catch (e: any) {
console.log("error login !",e)
}
is this code the catch block is never triggered, when the authentication failed the user is null but how can i have a error message ? https://authts.github.io/oidc-client-ts/#md:events didnt help
there is auth.error but this value is not updated immediatly after
await auth.signinResourceOwnerCredentials({
username: values.email,
password: values.password,
})
console.log(auth.error); // still undefined for some time even with a login error
there is auth.error but this value is not updated immediatly after
That is by design of the reducer within this library, when you use the error in the render code it will work...