NextAuth where should I check if user exists in DB and password match?
Unanswered
Saltwater Crocodile posted this in #help-forum
Saltwater CrocodileOP
Hey!
Where should i check if the user exists in DB and if the passwords match when signing in?
Should this be done in providers > credentials > authorize or in my form action function which validates input to check for empty values etc?
I'm validating at the moment in the authorize function, and using a try catch before calling signIn so that if the credentials do not match I can provide the user with an error.
But even though I am using a try catch block I still get this error on the server console, and I would like to avoid logging this "auth][error] CredentialsSignin: Read more at https://errors.authjs.dev#credentialssignin"
Where should i check if the user exists in DB and if the passwords match when signing in?
Should this be done in providers > credentials > authorize or in my form action function which validates input to check for empty values etc?
I'm validating at the moment in the authorize function, and using a try catch before calling signIn so that if the credentials do not match I can provide the user with an error.
But even though I am using a try catch block I still get this error on the server console, and I would like to avoid logging this "auth][error] CredentialsSignin: Read more at https://errors.authjs.dev#credentialssignin"
1 Reply
@Saltwater Crocodile Hey!
Where should i check if the user exists in DB and if the passwords match when signing in?
Should this be done in providers > credentials > authorize or in my form action function which validates input to check for empty values etc?
I'm validating at the moment in the authorize function, and using a try catch before calling signIn so that if the credentials do not match I can provide the user with an error.
But even though I am using a try catch block I still get this error on the server console, and I would like to avoid logging this "auth][error] CredentialsSignin: Read more at https://errors.authjs.dev#credentialssignin"
Saltwater CrocodileOP
solved!
i needed to check if the trown error was instance of autherror
i needed to check if the trown error was instance of autherror