Sign in with Apple
Enable Sign in with Apple on your App ID, create the Services ID and key, and connect them to AppCore for native iOS sign-in.
On this page
On iOS your app calls Sign in with Apple (sign_in_with_apple) with the SHA-256 of a random nonce, receives an
identity token, and sends it with the raw nonce to AppCore (POST /v1/auth/social). AppCore verifies the token
against Apple's published keys, checks issuer, audience, expiry and that the token's nonce equals the SHA-256 of the raw
nonce, and accepts each token only once. A token without a nonce is rejected. Hide My Email relay addresses are flagged
on the account; email is optional. Apple sends the user's name only on the first sign-in. The API accepts it
(given_name, family_name) and keeps the first name it receives, but the current SDK bridge does not forward it yet,
so the name comes from the token claim when present.
Apple uses three separate key purposes. This guide is the Sign in with Apple key only; the APNs key (push) and the In-App Purchase key (App Store Connect) are different keys. Console paths are as of 2026-11.
Warning
Not yet enabled:
- Sign in with Apple on Android and the web. The browser flow (
/v1/auth/oauth/start,/v1/auth/browser-exchange) returns503 FEATURE_UNAVAILABLE, and/api/auth/callback/appleis not served yet. Offer Google or email sign-in on Android. - Apple account-change notifications.
/webhooks/apple-identity/{connection_ref}is in the API contract but the runtime does not serve it yet (404). Do not register it with Apple. - Revoking the Apple authorization when a user deletes their account. Deletion blocks the user and revokes AppCore sessions, but does not yet call Apple's token revocation.
Note
Accepted audiences come from the active apple_auth connection: its Allowed audiences list, or, if that is
empty, the bundle ID (and Services ID) you entered. A per-environment deployment setting is only a fallback for
development before a connection exists. If neither provides an ID, Apple sign-in returns 503 FEATURE_UNAVAILABLE.
Before you begin
- Apple Developer Program membership. Creating keys needs the Account Holder or Admin role.
- The App ID (bundle ID) for this environment's iOS build flavor.
- Your environment's API host,
https://<your-api-host>. - If you will email users: the sending domain you set up in Cloudflare Email Sending.
Steps
Enable the capability. developer.apple.com → Account → Certificates, Identifiers & Profiles → Identifiers → your App ID. Tick Sign In with Apple and save. In Xcode, add the Sign in with Apple capability to the target.
Find your Team ID. Account → Membership details → Team ID (10 characters).
Create a Services ID. Identifiers → ➕ → Services IDs → Continue. Give it an identifier such as
com.example.app.signin, register it, then open it, tick Sign In with Apple and Configure:- Primary App ID: your App ID.
- Domains and Subdomains: your API host without
https://. - Return URLs:
https://<your-api-host>/api/auth/callback/apple.
AppCore requires the Services ID now and uses it for the automated key check, even though the browser flow that uses the return URL is not enabled yet.
Create the key. Keys → ➕. Name it, tick Sign in with Apple, Configure → choose the primary App ID → Save → Continue → Register → Download. The
.p8file downloads once. Note the Key ID.Private email relay. Certificates, Identifiers & Profiles → Services → Sign in with Apple for Email Communication → Configure. Register the domain or from-addresses you send email from, so mail reaches users who chose Hide My Email.
In AppCore, open Setup and connections → Connections, create a Sign in with Apple connection, fill in the public fields and save. Paste the whole
.p8file (including the-----BEGIN PRIVATE KEY-----and-----END PRIVATE KEY-----lines) intoprivate_key_p8, then delete the local file.Run Check syntax, then Read-only check, then Activate.
In your Flutter app on iOS:
Dartfinal result = await core.auth.signInWithSocial(AppleSignInBridge());
Paste into AppCore
| AppCore field | Where to find it | Secret? |
|---|---|---|
team_id | Account → Membership details → Team ID | Public |
bundle_id | Identifiers → your App ID → Bundle ID | Public |
services_id | Identifiers → Services IDs → your Services ID → Identifier | Public |
key_id | Keys → your Sign in with Apple key → Key ID | Public |
private_key_p8 | The downloaded AuthKey_<KEYID>.p8 file, whole contents | Secret (write-only) |
allowed_audiences | Your bundle ID and Services ID | Public |
relay_email_sources | Services → Sign in with Apple for Email Communication → registered domains / addresses | Public |
native_callback_allowlist | The return URLs you registered on the Services ID, starting with https://<your-api-host>/api/auth/callback/apple | Public |
Verify
- Read-only check passes with
APPLE_CLIENT_AUTHENTICATED: AppCore signed a client secret with your key and sent a deliberately invalid code to Apple's token endpoint; Apple answeringinvalid_grantproves the Team ID, Key ID, Services ID and key belong together. Nothing is created at Apple. - After Activate in staging the connection is
pending_approval, andappleappears inauth_methodsofGET https://<your-api-host>/v1/config/public. - Sign in on a real iOS device, first time and again. Record the login session as evidence for
apple-login(stagesandbox). Checkapple-revokecannot be completed until authorization revocation is implemented, so the connection stayspending_approvalin staging; that does not block sandbox use.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Read-only check fails with PROVIDER_AUTH_REJECTED (invalid_client) | Team ID, Key ID or Services ID do not match the key, or the key is not configured for Sign in with Apple | Check the key's Configure primary App ID; use the Services ID the key's App ID is grouped with |
INVALID_P8_KEY | The pasted value is not the whole .p8 file | Paste the full file including the BEGIN/END lines |
apple_wrong_key_type | You uploaded the APNs or In-App Purchase key | Create a key with Sign in with Apple ticked |
401 SOCIAL_TOKEN_REJECTED | Nonce missing or not matching, audience not your bundle ID, expired, or token reused | Use AppleSignInBridge unchanged (it hashes the nonce for Apple and sends the raw nonce to AppCore); get a fresh token per sign-in |
503 FEATURE_UNAVAILABLE "apple sign-in is not configured" | No accepted audiences: the apple_auth connection is not active or has no bundle ID | Activate the connection with your bundle ID in this environment |
| User's name is empty | Apple sends the name only on the very first authorization, and the SDK bridge does not forward it yet | Collect the name in your app's profile screen for now |
Emails to @privaterelay.appleid.com bounce | Sending domain not registered for the relay | Complete step 5 with the same domain as your email sender |