Documentation / v1 / Connections

Connect Apple

Sign in with Apple through a form-post callback and a per-request client-secret JWT. Built and tested locally against a stand-in; no Apple team was used.

State in this release

Built and tested locally against a stand-in for Apple that checks what the service sends: the client-secret JWT verified against the team's key, the form post callback, the refusal of replays, other browsers and other connections, and the private-relay rules. No Apple developer team, Services ID or key was used, so Apple's consent screen, review requirements and relay behaviour are untested here. Run it once against your own team before relying on it.

This is the OpenID Connect guide with Apple's differences handled by the service; read it for mapping, linking, domain claims and the sign-in journey.

What the preset does

The issuer and endpoints are Apple's, and another issuer is refused. The authorization request asks for the form post response mode and Apple posts the code and state to the connection's callback. The callback accepts only the method its provider uses: an Apple connection refuses a GET, every other type refuses a POST, and a refused request spends nothing. The correlation cookie is sent SameSite=None and Secure for this type in every environment because it must travel on Apple's cross-site POST.

The connection's secret is the team's Sign in with Apple private key, the p8 file, stored encrypted and never returned or logged. For each code exchange the service signs an ES256 JWT with it, issued by your team for your Services ID, audience Apple, valid five minutes. A key that cannot sign is refused when you store it.

The identity is Apple's issuer and the account's sub, never an address. The user form field Apple posts on the first authorisation is unauthenticated display text: at most a plain, bounded first and last name is read from it and never its address. A posted id_token is ignored; the ID token is read from Apple's token endpoint after the code exchange and verified.

A private-relay address is never a verified address. An address counts as verified only when Apple asserts it verified and it is not a relay address. A relay address is stored on a new account unverified and never links an existing account, and a mapping rule cannot change that.

Create the connection

At Apple create a Services ID, enable Sign in with Apple for it with the connection's callback URL as a return URL, and create a key: note the Key ID and your Team ID, and download the p8 once. Then create the connection with the strategy apple, a config holding client_id, team_id and key_id, and the p8 as client_secret. Register exactly the callback_url the response carries at Apple. Enable it with the status route and sign in through your application, or try it first with the console test login, which shows the decoded claims and creates nothing.

Request · json
POST /v1/console/accounts/{account_id}/directories/{directory_id}/connections
{
  "strategy": "apple",
  "display_name": "Sign in with Apple",
  "config": { "client_id": "com.example.signin", "team_id": "ABCDE12345", "key_id": "FGHIJ67890" },
  "client_secret": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
  "jit_enabled": true
}

Linking existing accounts

Apple may hide the address behind a relay, so most Apple sign-ins will not meet the linking rule, on purpose. An existing account is linked only when Apple asserted the real address verified, the connection is trusted for email, the address domain has a verified claim on the connection, and the person has no other federated identity. Otherwise nothing is attached on Apple's word: the person proves the existing account first, or is refused when link_policy is never.

Not covered

Apple's server-to-server notifications for revoked consent and deleted accounts are not received.