Overview
The Zenda API uses Bearer token authentication. All API endpoints require a valid authentication token to be included in the request headers.Authentication Method
Authentication is handled via theAuthorization header using a Bearer token:
How It Works
The API uses Supabase for authentication. When you make a request:- The API extracts the token from the
Authorizationheader - Validates the token with Supabase
- Verifies the user exists and the token is not expired
- Attaches user information to the request
server/src/common/guards/auth.guard.ts:10-28.
Making Authenticated Requests
Error Responses
Missing Token
If no token is provided:Invalid or Expired Token
If the token is invalid or expired:Getting an Access Token
To obtain an access token, you need to authenticate with Supabase. The token should be obtained through Supabase’s authentication flow:- Sign in or sign up through Supabase Auth
- Retrieve the session access token
- Use the token in your API requests
Access tokens expire after a certain period. Make sure to refresh your token when needed using Supabase’s token refresh mechanism.
Security Best Practices
- Never expose your access tokens in client-side code or public repositories
- Always use HTTPS in production
- Implement token refresh logic to handle expired tokens
- Store tokens securely (e.g., in httpOnly cookies or secure storage)
Next Steps
Reservations API
Start managing reservations
Profiles API
Manage user profiles