Skip to main content

Authentication

The Revelation 14 API uses JWT (JSON Web Tokens) for authentication. All API requests must include a valid access token in the Authorization header.

Authentication Flow

Getting an Access Token

Login Endpoint

POST /auth/login

Authenticate a user and receive an access token
Endpoint: https://rzqklwfhwqmviintncqh.supabase.co/functions/v1/auth/login Headers:
  • Content-Type: application/json
  • apikey: your_supabase_anon_key
Request Body:
Response:

Using Access Tokens

Include the access token in the Authorization header for all authenticated requests:

JWT Token Structure

The JWT token contains the following payload:
Fields:
  • id: Unique user identifier
  • role: User role (STANDARD_USER, ADMIN, etc.)
  • iat: Issued at timestamp
  • exp: Expiration timestamp

Token Expiration

  • Default Expiration: 2 hours
  • Refresh: Tokens must be refreshed by re-authenticating
  • Validation: Tokens are validated on each request
Tokens expire after 2 hours. Your application should handle token expiration gracefully and prompt users to re-authenticate when needed.

User Roles

Security Best Practices

Secure Storage

Store tokens securely on the client (encrypted storage, keychain)

HTTPS Only

Always use HTTPS for API communications

Token Validation

Validate token expiration before making requests

Logout Handling

Clear tokens on logout or app uninstall

Error Responses

401 Unauthorized

401 Invalid Token

400 Invalid Credentials

Code Examples