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: export CredentialsSignin class to extend in custom authorize errors #10200

Merged
merged 4 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion packages/core/src/providers/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export interface CredentialsConfig<
* @example
* ```ts
* async authorize(credentials, request) { // you have access to the original request as well
* if(!isValidCredentials(credentials)) return null
* if(!isValidCredentials(credentials)) {
* throw new CustomError()
* }
* return await getUser(credentials) // assuming it returns a User or null
* }
* ```
Expand Down
1 change: 1 addition & 0 deletions packages/frameworks-express/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ import type { AuthConfig, Session } from "@auth/core/types"
import * as e from "express"
import { toWebRequest, toExpressResponse } from "./lib/index.js"

export { AuthError, CredentialsSignin } from "@auth/core/errors"
export type {
Account,
DefaultSession,
Expand Down
9 changes: 9 additions & 0 deletions packages/frameworks-solid-start/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
import { Auth } from "@auth/core"
import type { AuthAction, AuthConfig, Session } from "@auth/core/types"

export { AuthError, CredentialsSignin } from "@auth/core/errors"
export type {
Account,
DefaultSession,
Profile,
Session,
User,
} from "@auth/core/types"

export interface SolidAuthConfig extends AuthConfig {
/**
* Defines the base path for the auth routes.
Expand Down
2 changes: 2 additions & 0 deletions packages/frameworks-sveltekit/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ import { setEnvDefaults } from "./env"
import { auth, signIn, signOut } from "./actions"
import { Auth, isAuthAction } from "@auth/core"

export { AuthError, CredentialsSignin } from "@auth/core/errors"

export type {
Account,
DefaultSession,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-auth/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import type {
import type { AppRouteHandlerFn } from "./lib/types.js"
import type { NextRequest } from "next/server"
import type { NextAuthConfig, NextAuthRequest } from "./lib/index.js"
export { AuthError } from "@auth/core/errors"
export { AuthError, CredentialsSignin } from "@auth/core/errors"

export type {
Session,
Expand Down
Loading