Repository navigation
feat(auth0-api-js): organizationPolicy enforcement - #291
Merged
Merged
Conversation
nandan-bhat
reviewed
Oct 8, 2026
nandan-bhat
approved these changes
Oct 19, 2026
…fication
Add `organizationPolicy` ('allow' or 'required') and `organizationId` (an id
or allowlist of ids) to ApiClient options. With 'required', verifyAccessToken
rejects tokens without an `org_id` claim, and rejects tokens whose `org_id` is
not in the allowlist, using MissingOrganizationError and
OrganizationNotAllowedError (both 401 with WWW-Authenticate challenges).
The policy and allowlist are validated and snapshotted at construction, so a
bad value fails fast and later mutation of the caller's options cannot weaken
enforcement.
Co-Authored-By: Claude <noreply@anthropic.com>
tusharpandey13
force-pushed
the
feat/mcp-p1-org
branch
from
October 21, 2026 10:50
b9da34f to
eaea3ac
Compare
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.
What
Organization-policy enforcement for
@auth0/auth0-api-js. An API can now require or allowlist the caller's organization, enforced only from the verified access token.Contract
Two client-level options on
ApiClientCommonOptions:organizationIdwhen the policy is not'required'and throwsInvalidConfigurationError.verifyAccessToken, against the verifiedorg_idclaim only.'required': a missingorg_idthrowsMissingOrganizationError; anorg_idoutside the allowlist throwsOrganizationNotAllowedError. A string allowlist is coerced to a one-element list.'allow'(the default): no check runs and behavior matches the current release.VerifyAccessTokenError(HTTP 401), with codesmissing_organizationandorganization_not_allowed.Acceptance
organizationIdwith a non-'required'policy fails construction'required'plus missingorg_idthrowsMissingOrganizationError(401)'required'plus anorg_idoutside the allowlist throwsOrganizationNotAllowedError(401)'allow'default leaves behavior unchangedDelivery
Independent PR against
main. No dependency on the other Phase-1 PRs, so it is safe to merge first.Summary by CodeRabbit