Skip to content

Add OAuth login (PKCE) with bearer-auth API calls#18

Open
lukaskroepfl wants to merge 1 commit into
mainfrom
feat/oauth-login
Open

Add OAuth login (PKCE) with bearer-auth API calls#18
lukaskroepfl wants to merge 1 commit into
mainfrom
feat/oauth-login

Conversation

@lukaskroepfl
Copy link
Copy Markdown
Member

Summary

  • Adds bitmovin login and bitmovin logout. Login runs a browser-based OAuth flow (Authorization Code + PKCE), captures the callback on a fixed loopback port, and stores access + refresh tokens in the config file.
  • Subsequent commands construct the SDK with Authorization: Bearer … and refresh the access token silently when it nears expiry; the user only re-authenticates when the refresh token itself stops working.
  • Credential resolution order is now: --api-key flag > BITMOVIN_API_KEY env var > stored OAuth session > api-key in config. Config file is written with mode 0600.

Notes

  • IdP defaults are env-overridable: BITMOVIN_OAUTH_ISSUER, BITMOVIN_OAUTH_CLIENT_ID, BITMOVIN_OAUTH_AUTHORIZE_URL, BITMOVIN_OAUTH_TOKEN_URL, BITMOVIN_OAUTH_SCOPE, BITMOVIN_OAUTH_REDIRECT_PORT.
  • config show now reports the OAuth user, expiry, and whether a refresh token is present (text + --json).
  • bitmovin login --print-url skips opening a browser (useful over SSH).

Test plan

  • npm run lint && npm test — 184 tests passing locally
  • bitmovin login opens browser, completes auth, stores session
  • bitmovin account info works using bearer auth from the stored session
  • Tamper with expiresAt in config (or wait) → next command silently refreshes
  • bitmovin logout clears OAuth, preserves any api-key fallback
  • --api-key flag / BITMOVIN_API_KEY still override OAuth

🤖 Generated with Claude Code

Adds `bitmovin login` and `bitmovin logout`. Login runs a PKCE flow against
the Bitmovin IdP, captures the callback on a fixed loopback port, and stores
the resulting access + refresh tokens in the config file. Subsequent commands
construct the SDK with `Authorization: Bearer …`, refreshing the access token
silently when it expires.

Credential resolution: `--api-key` flag > `BITMOVIN_API_KEY` env > stored
OAuth session > `api-key` in config. The config file is now written with
0600 perms.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lukaskroepfl lukaskroepfl requested a review from mateun May 22, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant