Let people sign in with Apple on your website
Use AirHost's sign-in, or have an Agent register a Services ID, set your website's domains and return URLs, and make the Sign in with Apple key your server needs.
Sign in with Apple on a website works through a Services ID on your Apple team: it names your website to Apple, lists the domains it runs on and the return URLs Apple sends people back to, and is tied to your app’s App ID. Your website’s server also needs a Sign in with Apple key. Your Agents set up most of it; one step is yours, in your Apple Developer account.
If your website runs on AirHost
AirHost, AirBuild’s hosting for your app, has sign-in of its own. While your app has no sign-in yet, the App Users tab says Add Sign-In to This App, with “Sign in with Apple and Google, ready to use”. Once the app uses it, the people who sign in are listed there. To add it, tap Ask Agents to Add on that tab, or ask in the chat. See Host your app’s backend, database and sign-in (AirHost).
The rest of this page sets up Sign in with Apple under your own Apple team, for a website whose sign-in you run yourself.
Before you start
- The Team’s owner has connected an Apple Developer account and switched a team on. See Connect your Apple Developer account.
- Sign in with Apple is turned on for your app’s App ID. If it isn’t, ask “Turn on Sign in with Apple for the app.” See Turn on iCloud, App Groups or another capability.
- You know your website’s domain, such as
example.com, and its return URL, the address Apple sends people back to after they sign in, such ashttps://example.com/auth/apple/callback. Whoever writes the website’s sign-in code decides the return URL. - You can sign in to your Apple Developer account on the web, for one step.
Register a Services ID
Ask in the Project’s chat, for example:
Register a Services ID for Sign in with Apple on our website, called "Notes Web", with the identifier com.example.notes.web.The Agent registers it with asc web service-ids create. The command runs only with --confirm, because it changes your Apple Developer account, so the Agent asks you first. Your website’s sign-in code uses the identifier, so note it.
The new Services ID has nothing turned on yet. The command’s help says to configure Sign in with Apple for it in the Developer Portal, which is the next step.
Turn on Sign in with Apple for it
asc can’t do this step; you do it in your Apple Developer account on the web. Apple’s Configure Sign in with Apple for the web ↗ page walks through it: open the Services ID, turn on Sign in with Apple, choose your app’s App ID as its primary App ID, and enter your website’s domains and return URLs.
Set the domains and return URLs
To check the domains and return URLs, or to change them later, ask, for example:
Set the Sign in with Apple domains for com.example.notes.web to example.com and www.example.com, with the return URL https://example.com/auth/apple/callback.The Agent uses asc web service-ids domains set. It replaces both lists with what you give it, so name every domain and return URL you want to keep, not only the new ones. It runs only with --confirm, so the Agent asks you first. It keeps the primary App ID as it is, and reports success only once a fresh read shows the saved values.
| Value | What the command accepts |
|---|---|
| Domains | Host names only, such as example.com: no https://, port or path. International names in punycode. |
| Return URLs | Full https:// addresses with no user name, password or # part. Each one’s host has to be in the domain list. |
Make the key for your server
Ask, for example:
Make a Sign in with Apple key called "Notes Web Key" for the app, and tell me where you saved it.The Agent makes it with asc web sign-in-keys create, tied to your app’s App ID. Apple’s Revoke, edit, and download keys ↗ page says a key file can be downloaded only once, and the command downloads it right away, so it runs only with --confirm and the Agent asks you first. It saves the file in a folder the Agent names, on the computer it works on, never over another file, and it never prints the key. It reports the key’s ID (Key ID), its name and where the file is.
If you already have a key, ask “Which Sign in with Apple keys do we have?” first. asc web sign-in-keys list shows each key’s ID, its name and whether its file can still be downloaded. It also lists keys for other Apple services.
Give your server what it needs
Your website’s sign-in code needs:
- the Services ID’s identifier, from the first step;
- your Apple Team ID, shown under the team in Settings › Developer;
- the Key ID, and the key file.
Apple’s Sign in with Apple ↗ documentation says how a server uses them. If your Agents write the website in this Project, ask them to set up its sign-in with these.
To use the key on a server you run outside AirBuild, take a copy as below and install it there. Keep the file safe:
- Ask the Agent to save the key file in a folder the project’s
.gitignoreleaves out, such assecrets/, and to tell you its path. That keeps it out of the repository, a shared link and an export of the source: see Share or export a project’s source. It still shows in Files, dimmed, where anyone in the Team can open it. - To take a copy, open it in Files and use Export (see Find the files and documents Agents made), or ask the Agent to send it to you in your DM with that Agent (see Create group chats and talk to one Agent), then touch and hold the file (on the Mac, right-click it) and choose Save As…. Don’t ask for the key in the Project’s chat: everyone in the chat can open it, and you can’t recall a message the Agent sent.
- If your website is on Vercel, the Vercel Agent changes environment settings. See Have an Agent deploy and check your Vercel projects.
See, change or remove
| Ask | asc |
|---|---|
| “Which Services IDs do we have?” | web service-ids list |
| “Rename the Services ID com.example.notes.web to Notes Website.” | web service-ids rename, only with --confirm, so the Agent asks you first. It keeps what’s turned on. |
| “Delete the Services ID com.example.notes.old.” | web service-ids delete, only with --confirm, so the Agent asks you first. |
| “Download the file for Notes Web Key again.” | web sign-in-keys download, if the list says the file can still be downloaded, and only with --confirm, so the Agent asks you first. |
| “Revoke the old Sign in with Apple key.” | Agents can’t: asc doesn’t revoke keys. Do it in your Apple Developer account; see Apple’s Revoke, edit, and download keys ↗. |
If something goes wrong
The Agent says to configure Sign in with Apple and its primary App ID in Developer Portal first.
The Agent says the return URL hosts must appear in the domains.
--return-url hosts must appear in --domain. Add the return URL’s host to the domain list, or fix the return URL.The Agent says a domain or return URL isn't valid.
--domain must contain DNS hostnames, without a scheme, port, or path, --domain must contain ASCII DNS hostnames (use punycode for international names) and --return-url must contain absolute HTTPS URLs without credentials or fragments. Give domains as plain host names and return URLs as full https:// addresses; see the table in Set the domains and return URLs.The Agent says the update was accepted but couldn't be checked.
The Agent says the key exists, but its file wasn't saved.
sign-in-keys download.