Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(errors): do not log authjs message with CredentialsSiginin error #11050

Merged
merged 2 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class InvalidCallbackUrl extends AuthError {
* 1. The user is redirected to the signin page, with `error=CredentialsSignin&code=credentials` in the URL. `code` is configurable.
* 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.
*/
export class CredentialsSignin extends SignInError {
export class CredentialsSignin extends Error {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaks types on CredentialsSignin #11155

static type = "CredentialsSignin"
/**
* The error code that is set in the `code` query parameter of the redirect URL.
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/lib/actions/callback/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,10 @@ export async function callback(
)
const user = userFromAuthorize

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

const account = {
Expand Down
Loading