Skip to main content

Authentication

Prism offers multiple authentication approaches: bearer token middleware for APIs, session-based auth for web apps, and the flexibility to build custom strategies.

Bearer Token Auth

PrismAuthMiddleware validates Authorization: Bearer <token> headers:
Token Auth

Database-backed Tokens

DB Token Validation

Session-based Auth

For web applications with cookies:
Session Auth

Custom Auth Middleware

Build your own for complex auth flows:
Custom Auth
Apply auth middleware to specific route groups instead of globally. Public routes like /health and /login shouldn’t require authentication.

Sessions

Deep dive into cookie-based sessions.

Rate Limiting

Protect authenticated endpoints from abuse.