Skip to content

feat: add --team to authorizations list and authorizations:create - #3928

Open
michaelmalave wants to merge 7 commits into
mainfrom
worker/gus-a3QEE000002hXIv2AM-team-list-create
Open

michaelmalave wants to merge 7 commits into
mainfrom
worker/gus-a3QEE000002hXIv2AM-team-list-create

Conversation

@michaelmalave

@michaelmalave michaelmalave commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a --team flag to the two authorizations commands whose Platform API operations are team-scoped, so a team admin can list and create team-owned OAuth tokens from the CLI. Consolidates the team-owned-tokens work into a single PR now that the API contract is confirmed: only the collection routes (GET/POST /teams/{team}/oauth/authorizations) are team-scoped.

  • Add --team to heroku authorizations (list) — routes to GET /teams/{team}/oauth/authorizations when set, otherwise the existing GET /oauth/authorizations.
  • Add --team to heroku authorizations:create — routes to POST /teams/{team}/oauth/authorizations when set, otherwise the existing POST /oauth/authorizations.
  • Send the version=3.sdk Accept header (SDK_HEADER) only on the --team path, which the team-authorizations route requires (assert_variant! "sdk"); the non-team path is byte-for-byte unchanged.
  • Add unit tests covering both the team and non-team paths for each command, asserting the 3.sdk header on the team path.

Type of Change

Feature Additions (minor semver update)

  • feat: Introduces a new feature to the codebase

Testing

Notes:
The --team path requires the target team to have the team-tokens feature flag and the caller to hold the manage_tokens capability. heroku-uat/heroku-dev-tools has been flagged in for testing.

Steps:

  1. git checkout worker/gus-a3QEE000002hXIv2AM-team-list-create && npm i && npm run build
  2. ./bin/run authorizations:create --team heroku-dev-tools --description "smoke test" — Expect: a created team-owned token printed.
  3. ./bin/run authorizations --team heroku-dev-tools — Expect: the team's authorizations listed (includes the one from step 3).
  4. heroku authorizations:revoke <AUTH_UUID> --team heroku-dev-tools — Cleanup to remove the test team token created for this.

Screenshots (if applicable)

Related Issues

GUS work item: W-24132432 — authorizations list --team
GUS work item: W-24132433 — authorizations:create --team

Adds an optional --team flag to `heroku authorizations` so it can list a
team's OAuth authorizations via GET /teams/:team/oauth/authorizations,
instead of the running user's tokens. Without --team, behavior is
unchanged. Reuses the existing table/JSON rendering and follows the
flags.team() convention already used by apps:index and usage:addons.
The team-owned authorizations API route (/teams/:team/oauth/authorizations)
is gated behind the 3.sdk API variant; without the Accept header the request
404s. Send SDK_HEADER on the --team path only and assert it in the team tests.
Adds --team to `heroku authorizations:create` so the created OAuth
authorization can be owned by a named team. When --team is set, the
command POSTs to /teams/${team}/oauth/authorizations (team value
encodeURIComponent'd); otherwise it keeps the existing
/oauth/authorizations user path. Existing flags (--description,
--expires-in, --scope, --json, --short) and the POST body are
unchanged.
The team-owned authorizations API route (/teams/:team/oauth/authorizations)
is gated behind the 3.sdk API variant; without the Accept header the request
404s. Send SDK_HEADER on the --team path only and assert it in the team test.

@jdodson jdodson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, this is a svelte PR.

Looked it over, tested it out and it looks good.

Approved.

@michaelmalave michaelmalave changed the title feat: add --team to authorizations list and authorizations:create DO NOT MERGE - feat: add --team to authorizations list and authorizations:create Sep 17, 2026
Comment thread src/commands/authorizations/create.ts Outdated
@michaelmalave
michaelmalave deployed to AcceptanceTests September 21, 2026 21:25 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 21, 2026 21:25 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 21, 2026 21:25 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 21, 2026 21:25 — with GitHub Actions Active
@michaelmalave michaelmalave changed the title DO NOT MERGE - feat: add --team to authorizations list and authorizations:create feat: add --team to authorizations list and authorizations:create Sep 22, 2026
@michaelmalave michaelmalave changed the title feat: add --team to authorizations list and authorizations:create DO NOT MERGE - feat: add --team to authorizations list and authorizations:create Sep 22, 2026
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:16 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:16 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:16 — with GitHub Actions Active
@michaelmalave
michaelmalave deployed to AcceptanceTests September 23, 2026 16:16 — with GitHub Actions Active
@github-actions github-actions Bot added the size/S Small PR (code churn < 100) label Sep 23, 2026
@michaelmalave michaelmalave changed the title DO NOT MERGE - feat: add --team to authorizations list and authorizations:create feat: add --team to authorizations list and authorizations:create Sep 23, 2026

This branch was successfully deployed

1 active deployment
AcceptanceTests — 0adc6ed9 Deployed Sep 23, 2026 by michaelmalave via integration (20.x, ubuntu-latest) #9268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE! size/S Small PR (code churn < 100)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants