Skip to content

LTRAC-638: feat(cli) - Look up the OAuth client ID from the CLI API - #3362

Open
jordanarldt wants to merge 1 commit into
canaryfrom
jordanarldt/ltrac-638-serve-the-cli-client-id-from-a-well
Open

jordanarldt wants to merge 1 commit into
canaryfrom
jordanarldt/ltrac-638-serve-the-cli-client-id-from-a-well

Conversation

@jordanarldt

@jordanarldt jordanarldt commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

TODO:

  • Before merge, ensure the DEVICE_OAUTH_CLIENT_ID is passed appropriately from the CLI API

What/Why?

The CLI hardcodes the OAuth client ID it uses for browser (device-code) login. When that ID was rotated earlier this year, every installed version stopped being able to log in until a patch shipped (#2998).

This change makes the CLI look the client ID up before logging in:

  • Before the device-code flow, the CLI calls GET {cli-api-origin}/.well-known/catalyst-cli.json and uses the client_id it returns for both the device-code request and the token poll.
  • If the lookup fails for any reason (404, network error, 3 second timeout, non-JSON body, missing or empty client_id), the CLI silently uses the client ID bundled with the release, which is the behaviour today. This means the change is safe to release before the endpoint is live.
  • The hidden --cli-api-origin option is now a shared option factory and is also accepted by auth login and projects create, so every login path can target a non-production CLI API.

Expected response body (extra keys are ignored):

{ "client_id": "<id>" }

Fixes #2998

Testing

  • pnpm test, pnpm typecheck, pnpm lint and pnpm build pass in packages/catalyst.
  • New specs cover: a served client ID is used, a custom origin is honoured, and each failure mode falls back to the bundled ID; the resolved ID is passed to both the device-code request and the token poll.
  • Not yet tested end to end with a real browser login against a live endpoint, since the endpoint is not deployed yet.

Migration

None.

🤖 Generated with Claude Code

Resolve the device-flow client ID from the CLI API's
/.well-known/catalyst-cli.json before browser login, so installed versions
keep working if the client ID is rotated. Falls back to the bundled ID when
the lookup fails or times out.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
catalyst Ready Ready Preview Dec 1, 2026 5:33pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e8196c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jordanarldt
jordanarldt marked this pull request as ready for review December 1, 2026 18:41
@jordanarldt
jordanarldt requested a review from a team as a code owner December 1, 2026 18:41

This branch was successfully deployed

1 active deployment
Preview — e8196c06 Deployed Dec 1, 2026 by vercel[bot]
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.

BigCommerce Catalyst v1.0.2 Crashes on Windows Before Store Verification Prompt

1 participant