Add OAuth login (PKCE) with bearer-auth API calls#18
Open
lukaskroepfl wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bitmovin loginandbitmovin 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.Authorization: Bearer …and refresh the access token silently when it nears expiry; the user only re-authenticates when the refresh token itself stops working.--api-keyflag >BITMOVIN_API_KEYenv var > stored OAuth session >api-keyin config. Config file is written with mode0600.Notes
BITMOVIN_OAUTH_ISSUER,BITMOVIN_OAUTH_CLIENT_ID,BITMOVIN_OAUTH_AUTHORIZE_URL,BITMOVIN_OAUTH_TOKEN_URL,BITMOVIN_OAUTH_SCOPE,BITMOVIN_OAUTH_REDIRECT_PORT.config shownow reports the OAuth user, expiry, and whether a refresh token is present (text +--json).bitmovin login --print-urlskips opening a browser (useful over SSH).Test plan
npm run lint && npm test— 184 tests passing locallybitmovin loginopens browser, completes auth, stores sessionbitmovin account infoworks using bearer auth from the stored sessionexpiresAtin config (or wait) → next command silently refreshesbitmovin logoutclears OAuth, preserves anyapi-keyfallback--api-keyflag /BITMOVIN_API_KEYstill override OAuth🤖 Generated with Claude Code