ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference
Introduction
Getting Started
    Develop using the Portal
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingMCP - Quick start
    Develop Locally
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth
Concepts
    How Zuplo WorksRequest LifecycleProject StructureAuthenticationAPI KeysRate LimitingAPI ErrorsRoutingPolicy FundamentalsOpenAPIEnvironmentsSource Control and DeploymentDevelopment Options
Development
Policies
Handlers
API Keys
MCP Server
MCP Gateway
AI Gateway
Developer Portal
Monetization
Deploying & Source Control
Observability
Networking & Infrastructure
Account Management
Programming API
Build with AI
Zuplo CLI
Migration Guides
Platform LimitsSecuritySupportTrust & ComplianceChangelog
powered by Zudoku
Concepts

Authentication

Zuplo supports multiple authentication methods through inbound policies. All authentication policies follow the same pattern: validate credentials, then populate request.user with the authenticated identity.

How authentication works

Authentication policies are inbound policies that run before your handler. When a request arrives:

  1. The auth policy extracts credentials (API key, JWT token, etc.)
  2. It validates the credentials against the configured provider
  3. On success, it populates request.user with the identity
  4. On failure, it returns a 401 Unauthorized response (short-circuiting the pipeline)

After authentication, all downstream policies and handlers can access request.user to make authorization decisions, apply per-user rate limits, or forward identity to your backend.

The request.user object

All authentication methods populate the same interface:

Code
interface RequestUser { sub: string; // Unique subject identifier data: Record<string, unknown>; // Provider-specific claims or metadata }

For JWT/OAuth authentication, sub comes from the token's sub claim and data contains the remaining token claims (email, roles, org, etc.).

For API key authentication, sub is the consumer identifier and data contains the metadata you set when creating the consumer (plan, customerId, etc.).

See RequestUser for the full type reference.

Supported methods

API key authentication

Zuplo's built-in API key management provides a complete system for issuing, managing, and validating API keys. Create consumers (API key holders) under Services in your project, via the API, or via developer portal self-serve.

Best for: B2B APIs, developer platforms, and any API where you manage consumer access.

JWT / OAuth authentication

Zuplo validates JWTs from any OpenID Connect-compatible identity provider. Built-in policies exist for common providers:

  • Auth0
  • Clerk
  • Okta
  • AWS Cognito
  • Firebase
  • Supabase
  • PropelAuth
  • OpenID Connect (generic)

Best for: APIs consumed by your own frontend, mobile apps, or services where users already authenticate with an identity provider.

Other methods

  • Basic Auth - Username/password authentication
  • mTLS - Mutual TLS certificate authentication
  • LDAP - LDAP directory authentication
  • HMAC - Hash-based message authentication

Combining authentication methods

You can support multiple auth methods on the same route (e.g., both API keys and JWT tokens). The pattern is:

  1. Add each auth policy to the route's inbound policies
  2. Set allowUnauthenticatedRequests: true on each so they don't immediately return 401
  3. Add a custom policy after them that checks request.user and returns 401 if no method succeeded

See Multiple Auth Policies for a detailed walkthrough.

Choosing an authentication method

MethodUse Case
API KeysB2B APIs, developer platforms, metered access
JWT (Auth0, Clerk, etc.)User-facing APIs, SPAs, mobile apps
mTLSService-to-service, high-security environments
Basic AuthInternal APIs, simple integrations
HMACWebhook verification, signed requests

For most API products, API key authentication is the recommended starting point. It provides self-serve key management, per-consumer rate limiting, and usage tracking out of the box.

Edit this page
Last modified on May 14, 2026
Project StructureAPI Keys
On this page
  • How authentication works
  • The request.user object
  • Supported methods
    • API key authentication
    • JWT / OAuth authentication
    • Other methods
  • Combining authentication methods
  • Choosing an authentication method
TypeScript