Authentication

Every API request needs a JWT bearer token in the Authorization header:

Authorization: Bearer <token>

Tokens identify both who is calling and which organization they belong to. All results are automatically scoped to that organization.

Principals

Lightning AI provisions an Administrator User Principal and an Application Principal for your organization, and delivers both through an encrypted channel. If you have not received yours, contact support. The Administrator then creates User Principals for the rest of the team in the console (in ORD1 first, with other regions to follow). See Managing users.

Principal Used by How it authenticates
User Principal People using the console, and the CLI to get API tokens Interactive sign-in through the browser
Application Principal Services, CI pipelines, automation A clientId and clientSecret, which the Python SDK exchanges for tokens

Use a User Principal for interactive work and an Application Principal for anything unattended. Don't share User Principal credentials with automation.

Getting a token with the Lightning Cloud CLI

The CLI signs you in as a User Principal. For automation with an Application Principal, use the Python SDK instead. It gets and refreshes tokens from the client ID and secret.

Install the CLI, then sign in. The CLI uses the OAuth 2.0 device authorization flow. It opens a browser to finish the sign-in, then caches and refreshes the token for you.

harbor auth login                 # sea1 by default
harbor auth login --region iad1   # another region
harbor auth status                # identity, organization, and expiry
harbor auth token                 # prints the raw access token
harbor auth logout

Tokens are cached per region under ~/.harbor/ and refreshed automatically before they expire. Each command picks its region separately, and login doesn't change the default, so pass the same --region to login and token. Use harbor auth token anywhere a token is needed:

export TOKEN=$(harbor auth token --region sea1)
curl "$API_URL/v1/fleets" -H "Authorization: Bearer $TOKEN"

Token scope

  • Region: a token is valid only for the region it was issued for. See Regions & endpoints.
  • Organization: a token can only see and change its own organization's resources. Requests for another organization's fleet return 404 Not Found.
  • Expiry: tokens are short-lived. When a call returns 401 Unauthorized, get a fresh token. The CLI does this automatically.

Roles

Each person in your organization is either a User or an Administrator. Users can view and operate fleets. Administrators can also control node power, manage SSH keys, read audit logs, and manage users. A request that your role doesn't allow returns 403 Forbidden.

See Roles & permissions for the full list.

Security recommendations

  • Store client secrets in a secrets manager, never in source control.
  • Never log full tokens. harbor auth status shows token metadata without printing the token.
  • Treat a downloaded kubeconfig as a credential. See Managed Kubernetes.
  • Review activity regularly with audit logs.

Was this page helpful?

What went wrong?

↑↓ Navigate↵ Open⌘↵ New tabesc Close