Documentation Index
Fetch the complete documentation index at: https://mintlify.com/egeuysall/ryva-archive/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Ryva API uses JWT (JSON Web Tokens) for authentication, powered by Supabase Auth. Most endpoints require a valid JWT token in the request headers.Authentication Flow
- User signs up or logs in through Supabase Auth
- Supabase returns a JWT access token
- Include the token in the
Authorizationheader for API requests - The API validates the token with Supabase
Getting a Token
Tokens are obtained through Supabase Auth. Here’s an example using the Supabase client:Making Authenticated Requests
Include the JWT token in theAuthorization header with the Bearer scheme:
Token Validation
The API validates tokens by:- Verifying the JWT signature using the Supabase JWT secret
- Checking token expiration
- Extracting user information from the token claims
Authentication Errors
Missing Token
Invalid Token
Insufficient Permissions
Token Lifecycle
Token Expiration
JWT tokens expire after a certain period (default: 1 hour). When a token expires, you’ll receive a 401 error.Refreshing Tokens
Use Supabase’s refresh token mechanism to get a new access token:Revoking Tokens
Sign out to revoke the current session:Public Endpoints
Some endpoints don’t require authentication:GET /health- Health checkPOST /v1/waitlist- Join waitlistPOST /v1/billing/webhooks/stripe- Stripe webhooks (verified by signature)
User Context
Authenticated requests automatically include user context:- User ID: Extracted from the JWT
subclaim - Email: Extracted from the JWT
emailclaim - Roles: Determined by organization membership
- Verify resource ownership
- Enforce role-based access control
- Audit actions
Security Best Practices
- Store tokens securely: Use secure storage mechanisms (e.g., httpOnly cookies, secure storage APIs)
- Use HTTPS: Always make API requests over HTTPS in production
- Implement token refresh: Refresh tokens before they expire
- Handle errors gracefully: Catch authentication errors and prompt users to re-authenticate
- Rotate secrets: Regularly rotate your Supabase JWT secret
Next Steps
Auth Endpoints
Manage user profiles and preferences
Organizations
Create and manage organizations