Cortex Docs

Authentication

Learn how to authenticate API requests with Cortex using JWT Bearer tokens, refresh tokens, and Two-Factor Authentication (2FA).

Authentication

The Cortex API utilizes JSON Web Tokens (JWT) for secure, stateless request authentication. All authenticated endpoints enforce Bearer authentication in the HTTP Authorization header.

Bearer Token Authentication

Include your access token in the Authorization header:

Authorization: Bearer <user_access_token>
curl -X GET https://api.cortexaso.com/api/user/profile/v1 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json"

Token Lifecycle

Token TypePurposeExpirationRefresh Mechanism
Access TokenAuthorizes API requests to protected endpoints15 minutesHandled via /user/auth/v1/refresh_token
Refresh TokenRotates expired access tokens30 daysStored securely in HTTP-only cookies or vault
Registration TokenVerifies email OTP during registration flow10 minutesOne-time use
Forgot Password TokenAuthorizes password reset following OTP confirmation10 minutesOne-time use

Never expose refresh tokens or long-lived credentials in client-side code repositories or public client bundles.

Two-Factor Authentication (TOTP)

Cortex supports standard RFC 6238 Time-based One-Time Passwords (TOTP) compatible with Google Authenticator, 1Password, and Apple Passwords.

  1. Initiate Setup: Call POST /api/user/2fa/v1/setup to receive your setup URI and manual secret key.
  2. Enable 2FA: Call POST /api/user/2fa/v1/enable with a valid 6-digit TOTP code to finalize setup and retrieve emergency recovery codes.
  3. Verify at Login: When 2FA is active, standard login prompts for a secondary code passed to POST /api/user/2fa/v1/verify_login.

On this page