Skip to content

Commit d089923

Browse files
authored
fix(errors): do not log authjs message with CredentialsSiginin error (#11050)
1 parent 77b20d5 commit d089923

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/core/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class InvalidCallbackUrl extends AuthError {
193193
* 1. The user is redirected to the signin page, with `error=CredentialsSignin&code=credentials` in the URL. `code` is configurable.
194194
* 2. If you throw this error in a framework that handles form actions server-side, this error is thrown, instead of redirecting the user, so you'll need to handle.
195195
*/
196-
export class CredentialsSignin extends SignInError {
196+
export class CredentialsSignin extends Error {
197197
static type = "CredentialsSignin"
198198
/**
199199
* The error code that is set in the `code` query parameter of the redirect URL.

packages/core/src/lib/actions/callback/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ export async function callback(
317317
)
318318
const user = userFromAuthorize
319319

320-
if (!user) throw new CredentialsSignin()
320+
if (!user) {
321+
console.error("Read more at https://errors.authjs.dev/#credentialssignin")
322+
throw new CredentialsSignin()
323+
}
321324
else user.id = user.id?.toString() ?? crypto.randomUUID()
322325

323326
const account = {

0 commit comments

Comments
 (0)