Skip to content
FlightStack Docs
Sign in Start free

API Authentication | FlightStack

FlightStack uses GitHub OAuth to issue user tokens, and a separate per-machine token system for build agents.

MethodPathAuthPurpose
POST/authentication/github-loginNoneComplete the OAuth code exchange and issue tokens.
POST/authentication/refresh-tokenNone (refresh in body)Refresh an expired access token.
POST/authentication/logoutBearerInvalidate the current refresh token.
GET/authentication/meBearerGet the authenticated user’s profile.
GET/github/oauth-urlBearerBuild the GitHub authorization URL.
POST/github/connectBearerLink a GitHub account to an existing user.

The standard OAuth flow has three steps:

  1. Build the OAuth URLGET /github/oauth-url?redirectUri=https://your.app/cb. Returns { "authorizationUrl": "https://github.com/login/oauth/authorize?…" }. Redirect the user.
  2. GitHub redirects back to your redirectUri with ?code=….
  3. Exchange the codePOST /authentication/github-login:
    {
    "code": "abc123...",
    "redirectUri": "https://your.app/cb"
    }
    Returns { accessToken, refreshToken, expiresAt, user }.

For CLI logins this is wrapped in flightstack login — it spins up a tiny localhost server, opens the browser, and finishes the exchange transparently.

Add the Authorization header to every authenticated request:

Terminal window
curl https://api.flightstack.voostack.com/authentication/me \
-H "Authorization: Bearer eyJhbG..."

Access tokens expire (typically 1 hour). Use the refresh token to mint a new one:

Terminal window
curl -X POST https://api.flightstack.voostack.com/authentication/refresh-token \
-H "Content-Type: application/json" \
-d '{"refreshToken":"eyJhbG..."}'

Returns { accessToken, refreshToken, expiresAt }. The new refresh token rotates — the old one is invalidated after a brief grace period.

Terminal window
curl -X POST https://api.flightstack.voostack.com/authentication/logout \
-H "Authorization: Bearer eyJhbG..."

Invalidates the refresh token. The access token still works until its natural expiry.

Terminal window
curl https://api.flightstack.voostack.com/authentication/me \
-H "Authorization: Bearer eyJhbG..."

Returns the authenticated user’s profile (id, email, avatarUrl, githubUsername, organizations, …).

A user who signed up another way can connect a GitHub account by calling POST /github/connect with the same { code, redirectUri } payload as login.

Build agents authenticate with an agent token in a different header:

Terminal window
curl https://api.flightstack.voostack.com/buildagent/{agentId}/poll \
-H "Agent-Token: eyJhbG..."

The agent token is issued by POST /buildagent (agent registration) and stored on the machine at ~/.flightstack/config.json under token. It’s scoped to a single agent — losing it requires re-registering.

See Agents for the full agent endpoint surface.