Skip to content

Commit

Permalink
fix: export CredentialsSignin class to extend in custom authorize e…
Browse files Browse the repository at this point in the history
…rrors (#10200)
  • Loading branch information
ndom91 committed Mar 4, 2024
1 parent 0b40a8a commit 9f97d1b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
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

0 comments on commit 9f97d1b

Please sign in to comment.