Skip to content

JWT Tokens

Frona AI uses JSON Web Tokens for authentication. This page covers the technical details of how tokens work.

Access tokens are standard JWTs containing:

  • User ID
  • Issued-at timestamp
  • Expiration timestamp

The token is signed with the server’s encryption secret (FRONA_AUTH_ENCRYPTION_SECRET).

TokenDefaultConfig variable
Access token15 minutesFRONA_AUTH_ACCESS_TOKEN_EXPIRY_SECS
Refresh token7 daysFRONA_AUTH_REFRESH_TOKEN_EXPIRY_SECS
Pre-signed URL24 hoursFRONA_AUTH_PRESIGN_EXPIRY_SECS

When an access token expires:

  1. The client sends a request to POST /api/auth/refresh
  2. The refresh token is read from the httponly cookie
  3. If valid, the server issues a new access token
  4. The new refresh token is set in the cookie

The frontend handles this automatically. You don’t need to manage token refresh manually.

For API requests, include the access token in the Authorization header:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

For SSE streams and WebSocket connections where headers aren’t easily set, you can pass the token as a query parameter:

GET /api/chats/{id}/messages/stream?token=eyJhbGciOiJIUzI1NiIs...

Some features use pre-signed URLs for temporary access to resources (like file downloads). These URLs contain a token in the query string and expire after 24 hours by default.

The FRONA_AUTH_ENCRYPTION_SECRET is used to sign JWTs and encrypt sensitive data. If you change this value, all existing tokens become invalid and users will need to log in again.

Use a strong, random secret in production. The default value (dev-secret-change-in-production) is only suitable for local development.