Add configurable base URL and JWT scope claim support#340
Open
jsj wants to merge 1 commit intoAvdLee:masterfrom
Open
Add configurable base URL and JWT scope claim support#340jsj wants to merge 1 commit intoAvdLee:masterfrom
jsj wants to merge 1 commit intoAvdLee:masterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48796b9d33
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
48796b9 to
704c1fc
Compare
The App Store Connect API base URL is currently hardcoded in `Request<Response>`, which prevents using the SDK's authentication and request infrastructure with related Apple APIs that share the same JWT-based auth but live at different base URLs (e.g. the Notary API at `appstoreconnect.apple.com/notary/v2/`). This change: - Promotes `baseURL` from a hardcoded internal computed property to a public stored property on `Request<Response>` with a default of the standard ASC API URL. Fully backward compatible — existing code compiles without changes. - Adds an optional `scope` parameter to `JWT` for APIs that require a restricted scope claim in the token payload (e.g. the Notary API requires `scope: ["/notary/v2"]`). Defaults to `nil`, which omits the claim entirely, preserving existing behavior.
704c1fc to
9e940fb
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.
Motivation
The App Store Connect API base URL is currently hardcoded in
Request<Response>, preventing use of the SDK's authentication and request infrastructure with related Apple APIs that share the same JWT-based auth but live at different base URLs.The primary use case is the Apple Notary API v2, which lives at
appstoreconnect.apple.com/notary/v2/(vsapi.appstoreconnect.apple.com) and requires ascopeclaim in the JWT payload. Today, anyone wanting to use the Notary API alongside the ASC API must build an entirely separate JWT + HTTP client despite sharing the same credentials.Changes
Request<Response>— configurablebaseURLbaseURLfrom a hardcoded internal computed property to a public stored property with a default of the standard ASC API URLdefaultBaseURLstatic computed property for referencebaseURLparameter defaults to the current valueJWT— optionalscopeclaimscope: [String]?parameter toJWT.init(defaults tonil)nil, the claim is omitted entirely from the encoded payload (standardCodablebehavior for optionals)["/notary/v2"]), it's included in the JWT payload as required by Apple's Notary API authentication docsUsage
Testing
🤖 Generated with Claude Code