2 SSO Flow
Nate edited this page 2026-11-21 20:21:39 -08:00

EVE SSO Flow

  1. Register the app at https://developers.eveonline.com with the callback URL from EVE_CALLBACK_URL, and put the issued client ID and secret in .env.

  2. Login: GET /auth/eve stores a random state in the session and redirects to login.eveonline.com requesting the scopes the chosen features need (see "Choosing what to link" on the Configuration page; a full link requests all 61 scopes in eveScopes, in internal/app/auth.go): the read scopes from the OAuth2 catalog in CCP's ESI OpenAPI document, plus seven that can change something, each for one feature:

    Scope What the app does with it
    esi-fittings.write_fittings.v1 "Save to EVE" in the fitting editor
    esi-mail.send_mail.v1 sending mail from the compose page
    esi-mail.organize_mail.v1 marking a mail as read
    esi-planets.manage_planets.v1 reading colonies; CCP publishes no read scope for planetary industry, and the app only ever reads
    esi-calendar.respond_calendar_events.v1 answering a calendar invitation
    esi-ui.open_window.v1 opening a contract or other window in the game
    esi-ui.write_waypoint.v1 setting a route in the game from the map

    The two other scopes that can change something in the game, contacts and fleets, are not requested. Characters linked before a scope was added keep the scopes they granted until they sign in again; the feature that needs the missing scope says so.

  3. Callback: GET /auth/callback verifies the state (constant-time, single-use), exchanges the authorization code for tokens, then verifies the access-token JWT: RS256 signature against CCP's JWKS (found via the OAuth discovery document), iss = login.eveonline.com. Character ID/name come from the sub/name claims.

  4. Persist: first login creates a row in users; the character is upserted into characters with the access/refresh tokens, expiry, and granted scopes. Re-login (or "Link another character" while signed in) attaches characters to the same account. The session token is rotated at sign-in.

  5. Character pull: the signed-in home page shows the character sheet: identity (name, portrait, corporation, birthday, security status), ISK wallet balance, total/unallocated SP, the currently training skill, and the 25 heaviest skills with names resolved via GET /universe/types/{id}/ (cached in-process and in the type_names table).

Tokens, authorization codes and the client secret are never logged; request logs contain paths only, no query strings.