Repository navigation
Conversation
…etes their account Apple requires apps that offer Sign in with Apple and account deletion to revoke the user's tokens on deletion (App Review 5.1.1(v)). At Apple sign-in the authorization code is now exchanged for a refresh token, kept encrypted in apple_sign_in_tokens; confirm-account-closure revokes it with Apple before deleting the account. The client secret is minted with core-api's AppleClientSecretFactory from the store's APN channel key when it also has Sign in with Apple enabled, or from a new 'apple_sign_in' notification channel, matched by bundle ID = the identity token's audience. Missing keys and Apple failures are logged and never block sign-in or deletion.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #165 +/- ##
=============================================
- Coverage 100.00% 99.93% -0.07%
- Complexity 4014 4058 +44
=============================================
Files 229 230 +1
Lines 14221 14357 +136
=============================================
+ Hits 14221 14348 +127
- Misses 0 9 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Apple requires apps that offer Sign in with Apple and account deletion to revoke the user's Apple tokens when the account is deleted (App Review guideline 5.1.1(v)). The server used to ignore the
authorizationCodethe app sends at sign-in, and account closure never contacted Apple.What changes
loginWithApple): the authorization code is exchanged athttps://appleid.apple.com/auth/tokenfor a refresh token. It is stored encrypted in a newapple_sign_in_tokenstable, one row per customer per app. The app (client_id) is the verified identity token's audience, andapple_user_idis its subject.confirmAccountClosure): the customer's tokens are revoked athttps://appleid.apple.com/auth/revokebefore the account is deleted. When the user account is deleted too, tokens kept for that user's other storefront customers are revoked as well. The rows are removed either way.AppleClientSecretFactory, which is already in^1.6.74, so no core change is needed. Keys come from the organization's notification channels, matched byapp_bundle_id= the token's audience:apple_sign_in, same fields as APN) for a separate key. It's added to Settings → Notifications in the Console and is tried first.invalid_clientfor one key, the next key is tried.docs/sign-in-with-apple.md.Upgrading
apple_sign_in_tokenson the storefront connection.Tests
AppleSignInRevocationTesthas 7 tests with Apple's endpoints faked and a real EC key. They cover the token being stored encrypted and replaced on the next sign-in; key choice and fallback (the APN key,invalid_clientfalling through to the next key, other apps and other organizations ignored); no key configured; Apple refusing the code; sign-in still succeeding on a timeout; revocation on closure; and closure still succeeding when Apple refuses, times out, no key is configured or the token table can't be read. Full suite: 1169 tests pass.Not in this PR
loginWithAppletakesemailandappleUserIdfrom the request instead of the verified token, and core'sAppleVerifierdoesn't check the audience. That needs a core-api change plus a matching Storefront change.