UNPKG

payload-authjs

Version:
52 lines (51 loc) 1.59 kB
import type { NextAuthConfig } from "next-auth"; import type { GeneratedTypes, Plugin } from "payload"; import { type EnrichedAuthConfig } from "../authjs/withPayloadAuthjs"; import type { SignInButtonOptions } from "./components/SignInButton"; export type AuthCollectionSlug<T = GeneratedTypes> = "auth" extends keyof T ? keyof T["auth"] : string; export interface AuthjsPluginConfig { /** * Enable or disable plugin * * @default true */ enabled?: boolean; /** * The slug of the collection that contains the users * * @default "users" */ userCollectionSlug?: AuthCollectionSlug; /** * Auth.js configuration * * @example * import { config } from "./auth.config"; * * authjsPlugin({ authjsConfig: config }) */ authjsConfig: EnrichedAuthConfig<NextAuthConfig>; /** * Enable the default local strategy from Payload CMS (experimental) * @see https://payloadcms.com/docs/authentication/jwt * * ! This does not work with database sessions (auth.useSessions: true) * * @default false */ enableLocalStrategy?: boolean; /** * Customize the components that the plugin adds to the admin panel */ components?: { /** * Customize the SignInButton component * Or set to `false` to disable the SignInButton component */ SignInButton?: SignInButtonOptions | false; }; } /** * The Auth.js plugin for Payload CMS */ export declare const authjsPlugin: (pluginOptions: AuthjsPluginConfig) => Plugin;