Add Sign in with Apple
Sign in with Apple is the login many iPhone users prefer, and it has more moving parts than any other provider. Here is each part, in order, plus the expiry date that breaks it later.

Key takeaways
- You need a paid Apple Developer Program membership, then an App ID, a Services ID, and a signing key.
- The client secret is a JWT you generate from that key, and Apple caps its lifetime at six months: put the renewal date in your calendar now.
- Users can hide their email behind an Apple relay address, and Apple shares their name only once, so plan your profile and emails around both.
To add Sign in with Apple to a web app, you need a paid Apple Developer Program membership. In Apple's developer portal you create an App ID with Sign in with Apple enabled, a Services ID that acts as the client ID for the web, and a private key for Sign in with Apple. You register your domain and your backend's auth callback as the return URL on the Services ID, then generate a client secret: a short JSON Web Token signed with that key. On Startbase Cloud, the Apple provider in Sign-in settings takes exactly those two values, the Services ID and the secret JWT. The secret expires after at most six months, so renewal is part of the setup.
Why add it at all
On iPhone, Sign in with Apple is one tap with Face ID, no typing, and many users trust it more than giving an app their email. It is especially worth it for consumer apps and games where a large share of visitors are on iPhones. It also matters if you later ship a native iPhone app through your own build: Apple's review guidelines expect a privacy-focused login option such as Sign in with Apple when an app offers other third-party logins like Google. (Startbase does not build App Store releases right now; this is for your own native build later.)
What you need
- An Apple Developer Program membership (a yearly fee, 99 US dollars for most individuals and organizations). A free Apple ID cannot create the identifiers below.
- A domain on HTTPS. Apple does not accept localhost or plain-http return URLs, so test on your published startbase.app address or custom domain.
- Startbase Cloud on the project, with access to Sign-in settings under Users.
- Your backend's auth callback URL (it ends in /auth/v1/callback; ask the agent for your project's exact address).
- A way to sign a JWT with your key. Several small tools and scripts do this; the agent can write a script you run locally so the key never leaves your machine.
The Apple side, in order
- 01App ID. In Certificates, Identifiers and Profiles, create an App ID (for example com.yourcompany.yourapp) and tick Sign in with Apple. It is the primary identifier your web login groups under.
- 02Services ID. Create a Services ID (for example com.yourcompany.yourapp.web). This string is your client ID for the web. Enable Sign in with Apple on it and configure: the primary App ID from step 1, your domains (yourapp.startbase.app, yourdomain.com), and the return URL, which is your backend's auth callback.
- 03Key. Under Keys, create a key with Sign in with Apple enabled and linked to the App ID. Download the .p8 file. Apple lets you download it only once, so store it safely (a password manager or encrypted vault), never in your project.
- 04Note three IDs. Your Team ID (top right of the portal), the Key ID, and the Services ID.
- 05Generate the client secret. Create a JWT signed with the .p8 key using ES256, with the Team ID as issuer, the Services ID as subject, https://appleid.apple.com as audience and an expiry no more than six months away. Apple rejects longer expiries.
The app side
- 01In your backend, open Users, then Sign-in settings, switch on Apple and paste the Services ID and the secret JWT. Saved secrets are never displayed again, and leaving the field empty on a later save keeps the stored value.
- 02In the URLs panel, confirm the Site URL and add every address users sign in from to the allowed redirect URLs.
- 03Ask the agent for the button and the flow. Apple publishes design rules for the button (black, white or outlined, with the Apple logo and approved wording such as "Sign in with Apple" or "Continue with Apple"); follow them.
What Apple sends back
- A stable user ID unique to your team. This is the identity that matters; an email can change, this does not.
- An email, which may be the user's real address or a relay address ending in privaterelay.appleid.com if they chose Hide My Email. Both are verified and both deliver mail, with one condition below.
- The name, once. Apple shares the user's name only on their first authorization, and web sign-in flows often do not pass it through at all. Do not rely on it: ask for a display name in your onboarding.
Relay addresses forward to the user's real inbox only from senders you register. In the developer portal, under the Sign in with Apple email communication settings, add the domain or address your app sends from. If your auth and app emails go out through your own domain (see the Emails docs), register that domain, or password resets and receipts to relay users will silently go nowhere.
A brief you can paste
Add Sign in with Apple to our sign-in and sign-up screens, using Apple's official black button style with "Continue with Apple", shown first on iPhone and second elsewhere. I have created the Services ID and key. Write a small local Node script that reads my .p8 key file path, Team ID, Key ID and Services ID from the command line and prints a client secret JWT expiring in 180 days; do not put the key in the project. After a first Apple sign-in, always ask for a display name because Apple may not share it. Handle relay emails ending in privaterelay.appleid.com as normal, verified emails. Tell me the exact return URL and domains to enter on the Services ID, and add a note to the admin page showing when the Apple secret expires.
Pitfalls
- invalid_client errors. Almost always a wrong value in the JWT: the Services ID where the App ID should be (or the reverse), a Key ID typo, the wrong Team ID, or an expiry beyond six months.
- Return URL rejected. It must be HTTPS on a domain listed on the Services ID, and must match your backend callback exactly.
- The expired secret. Covered above, and the most common way a working Apple login breaks months later.
- Lost .p8 file. You cannot download it again. Revoke the key, create a new one, and generate a fresh secret.
- Emails bouncing for relay users. Register your sending domain with Apple's private relay, and check your logs for relay addresses that never open anything.
- Expecting a real email. Treat the Apple user ID as the identity. If your app matches accounts by email, a user who hid theirs will look like a new person.
Most apps pair Apple with Sign in with Google and keep email as a fallback. User authentication explained walks through choosing the mix for your audience.
Frequently asked questions
Do I need a paid Apple developer account for Sign in with Apple?
Yes. Creating the App ID, Services ID and key requires an Apple Developer Program membership, which has a yearly fee.
Why did Sign in with Apple suddenly stop working?
Most often the client secret JWT expired. Apple limits it to six months, so generate a new one with your key and save it in your auth provider settings.
What is a privaterelay.appleid.com email?
It is a relay address created when a user chooses Hide My Email. Mail sent to it is forwarded to their real inbox, but only from sending domains or addresses you register with Apple.
Why does Apple not give me the user's name?
Apple shares the name only on the first authorization, and many web sign-in flows do not pass it through. Ask for a display name during onboarding instead.

