What Apple requires
Revoke on account deletion
Guideline 5.1.1(v): if the person deletes their account, their Apple tokens must be revoked.
Revoking needs a refresh token, which only the exchange of an authorization code returns.
Listen to Apple
Apple sends server-to-server notifications when someone stops using Sign in with Apple, deletes
their Apple ID or changes the forwarding of their hidden e-mail.
Hidden e-mail
“Hide My Email” hands out a
@privaterelay.appleid.com address that only accepts mail from domains
registered with Apple.The name arrives once
Apple sends the first and last name only on the app’s first authorization. Later sign-ins carry no
name.
Native on iOS, Services ID on Android and the web
That is why Supabase lists as Client IDs the Services ID and every bundle ID of the environment (the
native identity token carries the bundle ID as audience), and horizon-api uses the same ids in
APPLE_CLIENT_IDS, in the opposite order: the bundle IDs first and the Services ID last, with the
Services ID also in APPLE_SERVICES_ID (Rollout).
The client secret
Apple does not use a fixed secret: the client secret is an ES256 JWT signed with the environment’s.p8 key (APPLE_TEAM_ID, APPLE_KEY_ID, APPLE_PRIVATE_KEY), with audience
https://appleid.apple.com and a validity of at most 6 months.
The refresh token, encrypted
Apple’s refresh token is stored in theauth_provider_credential table, one row per login and
provider:
- Encryption uses its own keyring,
AUTH_PROVIDER_TOKEN_KEYRING(current and previous keys, re-encrypted on read), never the GoTrue bridge keyring. - The table has RLS and only the service role reads it.
Revocation on account deletion
When the person deletes their account in Settings,softDeleteLogin revokes the stored token of each
Apple login at appleid.apple.com/auth/revoke and then deletes the row. If Apple fails, the error is
logged and the deletion continues: our data is deleted anyway. To check it (MT-09): after deleting
the account, the Apple ID settings no longer list MaihueGO.
Server-to-server notifications
Apple callsPOST /api/v3/auth/oauth/apple/notifications, configured as the Server-to-Server
Notification Endpoint on each environment’s primary App ID. The endpoint is public and verifies the
JWS against Apple’s public keys (issuer https://appleid.apple.com, audience within
APPLE_CLIENT_IDS). An invalid JWS answers 400 before any rate-limit budget is spent.
- An event for an Apple user without a login here is acknowledged and ignored, so Apple does not retry it.
- The
auth_provider_notificationtable keeps the last applied event per Apple identifier and group (consentoremail). An event whose time is not newer than the last applied one is ignored: a retried oldemail-enablednever undoes a neweremail-disabled, and the same JWS posted twice does nothing. If the effect fails, the record goes back to the event applied before it (or is removed when there was none), so Apple’s retry applies it and an older event still cannot undo a newer one. - Limit: 20 per 10 minutes per Apple identifier, never per IP.
Hidden e-mail (Private Email Relay)
With “Hide My Email”, the@privaterelay.appleid.com address becomes the login e-mail and
user_metadata.is_private_email is set to true (from the identity token’s is_private_email claim).
Support uses it to explain why an e-mail looks random.
For those e-mails to arrive, the sending domains and addresses (Resend, its return-path domain and each
Supabase project’s SMTP sender) must be registered in Sign in with Apple for Email Communication.
Apple only accepts a domain whose SPF passes. See Rollout.
If that person later declares a document that already has an account, they can link their login to that
account instead of creating another one (see
Identity linking).
The name, only the first time
If Apple sends the name (first authorization), it is used. If it does not and the profile has no name, the response carriesneeds_name and the client asks for it: “Confirma tus datos” in the app,
auth/oauth/welcome on the web. An existing name is never replaced.