[spaceship] Support individual API key #21987
Open
+48
−5
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.
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validci/circleci
builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)Motivation and Context
Resolves #21959
Description
The main difference between a team API key and an individual API key is that the latter does not have
issuer_id
.So I made
issuer_id
optional and if it does not exist, fastlane treats the key as an individual API key.Since the JWT token payload of an individual API key is a bit different from a team API key, I changed the logic to generate token with following the official document.
https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests#4313913
Testing Steps
Sorry, I don't have a good idea to test whether if the generated JWT payload is valid or not, without exposing my individual API key.
However I tested it by writing a small lane like the following.
and confirmed that it works well in my private repo.