Skip to content

payload-fa/payload-otp

Repository files navigation

Payload OTP Authentication Example

This example provides a complete OTP (One-Time Password) authentication system built on Payload CMS. It includes endpoints for generating and verifying OTP codes.

Getting Started

  1. Clone the repository:

  2. Copy the environment file:

cp .env.example .env
  1. Install dependencies and start the development server:
pnpm install pnpm dev
  1. Open your browser and navigate to http://localhost:3000/admin
  2. Create an admin account and a user account

OTP Authentication

Here's how to use it:

Generate OTP

POST /api/auth/otp/generate Content-Type: application/json { "email": "user@example.com" }

Verify OTP

POST /api/auth/otp/verify Content-Type: application/json { "email": "user@example.com", "otp": "1234" }

For more details, check:

Releases

No releases published

Packages

No packages published