Skip to content

Authentication

Runsite Platform uses JWT (JSON Web Tokens) for authentication. Multiple authentication methods are supported.

TokenLifetimePurpose
Access token30 minutesAuthorize API requests
Refresh token7 daysObtain new access tokens
  1. RegisterPOST /api/auth/register with email, password, and name
  2. LoginPOST /api/auth/login returns access + refresh tokens
  3. Use API — include Authorization: Bearer <access_token> header
  4. RefreshPOST /api/auth/refresh with refresh token when access token expires
  5. LogoutPOST /api/auth/logout to invalidate the session

Runsite supports Google OAuth for one-click sign-in.

  1. Get OAuth URLGET /api/auth/google/url returns the Google consent page URL
  2. CallbackGET /api/auth/google/callback handles the redirect from Google and creates the session

The frontend redirects the user to the Google URL, and the callback automatically sets authentication cookies.

The frontend stores tokens in localStorage and uses Axios interceptors to:

  • Automatically attach the access token to every request
  • Queue requests on 401 and refresh the token transparently
  • Redirect to login if refresh fails

For programmatic access (CI/CD, CLI tools, integrations), you can use API keys instead of JWT tokens.

API keys use the Authorization: Bearer ak_live_... header — the same header as JWT, so switching between them is seamless.

See API Keys for details on creating and managing keys.

GET /api/users/me
POST /api/users/me/avatar
Content-Type: multipart/form-data
file: <avatar.png>
DELETE /api/users/me/avatar