UNPKG

@youngshand/payload-auth-plugin

Version:

A temporary fork for testing of Authentication plugin for Payload CMS, use @payload-auth-plugin

61 lines 1.68 kB
import type { OAuth2ProviderConfig, OAuthBaseProviderConfig } from "../../types.js"; interface Auth0AuthConfig extends OAuthBaseProviderConfig { domain: string; } /** * Add Auth0 OAuth2 Provider * * #### Callback or Redirect URL pattern * * - For Admin * ``` * https://example.com/api/admin/oauth/callback/auth0 * ``` * * - For App * ``` * https://example.com/api/{app_name}/oauth/callback/auth0 * ``` * * #### Plugin Setup * * ```ts * import { Plugin } from 'payload' * import {adminAuthPlugin, appAuthPlugin} from "payload-auth-plugin" * import {Auth0AuthProvider} from "payload-auth-plugin/providers" * * export const plugins: Plugins[] = [ * //For Admin * adminAuthPlugin({ * accountsCollectionSlug: 'adminAccounts', * providers:[ * Auth0AuthProvider({ * client_id: process.env.AUTH0_CLIENT_ID as string, * client_secret: process.env.AUTH0_CLIENT_SECRET as string, * domain: process.env.AUTH0_DOMAIN as string, * }) * ] * }) * * // For App * appAuthPlugin({ * name: 'app' * secret: process.env.APP_AUTH_SECRET, * accountsCollectionSlug: 'adminAccounts', * usersCollectionSlug: 'appUsers', * accountsCollectionSlug: 'appAccounts', * providers:[ * Auth0AuthProvider({ * client_id: process.env.AUTH0_CLIENT_ID as string, * client_secret: process.env.AUTH0_CLIENT_SECRET as string, * domain: process.env.AUTH0_DOMAIN as string, * }) * ] * }) * ] * ``` * */ declare function Auth0AuthProvider(config: Auth0AuthConfig): OAuth2ProviderConfig; export default Auth0AuthProvider; //# sourceMappingURL=auth0.d.ts.map