Skip to main content

Better Auth

Overview

Zeus uses Better Auth as its authentication solution, supporting email/password login and social login (GitHub, Google).

Architecture

GitHub Login Flow

Native Client Authentication (Desktop / iOS)

Desktop and iOS native clients use a dual-token mechanism:
Token TypeValidityStorage
accessToken (JWT)1 hourDesktop: JSON file / iOS: Keychain
refreshToken (opaque)30 daysDesktop: JSON file / iOS: Keychain
  • Both tokens are issued at login (via /api/auth/jwt or device authorization flow)
  • Before each API call, the client checks if the accessToken is about to expire (< 5 minutes)
  • When expired, the client automatically calls POST /api/auth/refresh to get a new accessToken
  • If the refreshToken is also expired, the user is automatically logged out
See Refresh Token API and JWT Service Authentication for details.

JWT Service Authentication

Dual-layer JWT authentication between Web and AI Backend

Database

Authentication-related database tables (user, session, account)