Skip to main content

Overview

BrokerOS uses Better Auth for all authentication. There are no custom JWT flows or API keys for regular users — authentication is session-based. Base auth path: POST /api/auth/*

Sign In

Request body:
Response:
The response also sets a better-auth.session_token HttpOnly cookie automatically. Web browsers use this cookie for all subsequent requests.

Sign Out

Invalidates the current session on the server. Returns 200 OK with no body.

Get Current Session

Response:
Returns 401 if no valid session exists.

Using Sessions in API Calls

Browser / Web App

The session cookie is set automatically. All fetch calls include it if you use credentials: 'include':

Mobile App (Expo)

The Better Auth Expo plugin handles cookie storage in expo-secure-store. All API calls from authClient.$fetch are automatically authenticated.

Scripts & Backend-to-Backend

Pass the session token in the Authorization header:

Errors