Documentation Index
Fetch the complete documentation index at: https://docs.serial.okos.com/llms.txt
Use this file to discover all available pages before exploring further.
Introduction to Serial’s API Authentication
In the world of modern web applications, securing API endpoints is crucial. Serial’s API implementation takes a robust approach to authentication, leveraging Zuplo to support two distinct authentication methods: JSON Web Tokens (JWT) for frontend applications and API keys for direct API access. This dual approach provides flexibility and security for different use cases.The Foundation: Zuplo Authentication
At the heart of Serial’s authentication system lies Zuplo, a powerful API management tool. Zuplo allows us to define and implement complex authentication policies with ease. Let’s take a closer look at how it’s configured:policies.json shows how we’ve set up both API key and JWT policies, along with a custom authentication check.
JWT Authentication for Frontend Applications
For frontend applications, Serial uses JWT authentication, which is handled by Supabase. When a user logs in through the frontend, Supabase issues a JWT that contains claims about the user, including their role and company ID. TheSupabaseJwtInboundPolicy in Zuplo validates these JWTs. Here’s how it works:
- The frontend application includes the JWT in the
Authorizationheader of API requests. - Zuplo’s
SupabaseJwtInboundPolicyverifies the token’s signature and expiration. - If valid, the user’s claims are extracted and made available to the API handlers.
API Key Authentication for Direct Access
For clients that need to access the API directly, such as third-party integrations or scripts, Serial provides API key authentication. This method is managed by theApiKeyInboundPolicy in Zuplo.
Here’s a glimpse of how API keys are handled in the codebase:
KeyRequestHandler class extends SerialRequestHandler, which is responsible for processing authenticated requests, whether they’re authenticated via JWT or API key.
Role-Based Access Control
Both authentication methods support role-based access control. TheSerialRequestHandler class includes methods to validate user privileges based on their role:

