This basic example demonstrates how to use the payload-authjs plugin.
- The Auth.js configuration is located in
src/auth.config.tsand the NextAuth instance is created insrc/auth.ts. - In the Payload CMS configuration (
src/payload.config.ts), we added thepayload-authjsplugin. - The middleware uses the authConfig from
src/auth.config.tsto be edge-compatible.
- Rename the
.env.examplefile to.envand update the values with your secrets. - Install dependencies:
pnpm install - Start the development server:
pnpm run dev