You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add organization support to test token command for M2M Applications (#1475)
* refactor: move checkClientIsAuthorizedForAPI to utils_shared.go and add org support
Moves checkClientIsAuthorizedForAPI out of test.go into utils_shared.go
alongside the other flow helpers it depends on.
Also adds organization support to the client credentials token request:
- BuildOauthTokenParams now accepts an organization parameter
- runClientCredentialsFlow forwards it to both the auth check and token request
- checkClientIsAuthorizedForAPI errors early when organization_usage is
"require" on the client grant but no organization was provided
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(test token): add organization support for M2M client credentials flow
Wires the --organization flag through to the client credentials token
request for Machine to Machine applications. Auth0 ignores the scope
parameter for client credentials grants (all granted scopes are always
returned), so --scopes now shows a warning and is ignored for M2M apps.
Also adds unit tests for checkClientIsAuthorizedForAPI covering the
organization_usage=require validation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* revert unused optimization of managementAPI var from prior iteration
* feat(test token): prompt org picker when M2M client grant requires organization
When the client grant for the selected API has organization_usage=require and
no --organization flag was provided, fetch the tenant's organizations and either
fail with a descriptive error (if none exist) or open an interactive picker so
the user can select one before the token request is made.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(test token): add unit tests for organizationPickerOptionsForGrant
Covers three cases: API error propagation, no organizations exist (with
descriptive error), and the happy path returning correctly shaped picker options.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(lint): fix receiver naming and trailing whitespace in test.go
Rename receiver `cli` to `c` in `pickOrganizationForGrantIfRequired` and
`organizationPickerOptionsForGrant` to be consistent with the rest of the file,
and remove trailing blank lines to satisfy gofmt.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ramya Anusri <62586490+ramya18101@users.noreply.github.com>
0 commit comments