Passkeys with AI agents
Use passkeys through Authentication Services so people can sign in without a password. Add the Associated Domains capability with the webcredentials service for your relying party domain, and host an apple-app-site-association file. Register or assert with ASAuthorizationPlatformPublicKeyCredentialProvider and ASAuthorizationController. Sign in with Apple is a separate request type. Look up Apple's Supporting passkeys docs first.
Last updated:
Apple facts are from "Supporting passkeys", "Public-Private Key Authentication", "Connecting to a service with passkeys", "ASAuthorizationPlatformPublicKeyCredentialProvider", "Password AutoFill", "Supporting associated domains" and "Associated Domains Entitlement" on developer.apple.com. Tool facts are from each README. Stars as of 16 Nov 2026.
What Apple documents
Authentication Services is the framework that makes it easy for users to log into apps and services. Under Public-Private Key Authentication, Apple documents two forms: passkeys and security keys. With passkeys, the authenticator (the person’s macOS, iOS or iPadOS device) generates a unique public-private key pair for every account, retains the private key, and shares the public key with the server (the relying party). The key pair is stored in the user’s iCloud Keychain and syncs across that person’s devices. Passkeys rely on biometric identification such as Touch ID and Face ID on iOS, or a specific confirmation on macOS. Security keys store the pair on a physical medium; this page does not cover them.
You need an associated domain with the
webcredentialsservice type when making a registration or assertion request; otherwise the request returns an error. Add the Associated Domains capability in Xcode and list the domain aswebcredentials:<fully qualified domain>. Host anapple-app-site-associationfile athttps://<fully qualified domain>/.well-known/apple-app-site-associationover HTTPS with a valid certificate and no redirects. The file must list the app’s Application Identifier Prefix and bundle identifier for that service. Starting with iOS 14 and macOS 11, devices fetch this file from an Apple-managed CDN, not directly from your server (an alternate developer or MDM mode can bypass the CDN during development).To register a new account, obtain a challenge from the server, create
ASAuthorizationPlatformPublicKeyCredentialProviderwith the relying party identifier (usually the service’s domain name), and build a platform key registration request with the challenge, the user name and the user ID. Present it withASAuthorizationController, set the controller’s delegate and presentation context provider, and callperformRequests(). The device displays a sheet asking the person to create a new credential.To sign in with an existing passkey, obtain a new challenge, create an assertion request from the same provider, and perform it with
ASAuthorizationController. You can pass additional assertion requests in the same array, such as passwords and Sign in with Apple; the sheet shows whatever credentials the device has for those types. If there are no credentials on the device, the request returns an error; ask the person to register. Handle success and errors inASAuthorizationControllerDelegate: a successful credential is anASAuthorizationPlatformPublicKeyCredentialRegistrationor anASAuthorizationPlatformPublicKeyCredentialAssertion. Verify it with the server. If the app also uses Sign in with Apple, handle that case in the same delegate method, following Sign in with Apple with AI agents.Password AutoFill can suggest passkeys alongside passwords. Set the user name field’s
textContentTypetousername, then callperformAutoFillAssistedRequests(). When the person taps the user name field, the system can suggest passkeys saved for the app.To change or reset a passkey, register a new platform key. The device generates a new public-private key pair; send the new public key to the server and discard the previous one. Registering a passkey with the same user ID as an existing one overwrites the existing passkey on the user’s devices.
For passkeys inside a web view, configure the service’s relying party identifier as an associated domain of the app. The app can’t use passkeys to authenticate for services that are not configured as the app’s associated domains. Apple also publishes a “Connecting to a service with passkeys” sample (iOS 16 and later) and a “Performing fast account creation with passkeys” sample (iOS 26 and later). Both require the Associated Domains capability and an AASA file for the service.
Rules for AGENTS.md
Code
- Use passkeys (Authentication Services platform public-key credentials) for passwordless sign-in. Do not treat them as interchangeable with Sign in with Apple; that is a separate request type (ASAuthorizationAppleIDProvider / ASAuthorizationAppleIDButton).
- Add the Associated Domains capability with the webcredentials service for the relying party domain, and host an apple-app-site-association file at https://<domain>/.well-known/apple-app-site-association. Do not invent the service string, and do not use applinks ([Universal Links with AI agents](/guides/ios-universal-links-ai-agents)) or appclips for passkeys.
- Obtain a server challenge, then register or assert with ASAuthorizationPlatformPublicKeyCredentialProvider and ASAuthorizationController (set the delegate and presentation context provider, call performRequests()). Verify the resulting registration or assertion with the server.
- For AutoFill, set the user name field’s textContentType to username and call performAutoFillAssistedRequests().
- Registering a passkey with the same user ID overwrites the existing passkey on the user’s devices. Look up Apple's “Supporting passkeys” docs before adding the capability or the authorization sheet.Step 1: ground the agent in Apple's passkey docs
Install Apple Docs MCP or Sosumi and ask it to open “Supporting passkeys”, “Public-Private Key Authentication”, “ASAuthorizationPlatformPublicKeyCredentialProvider” and “Supporting associated domains”. Confirm the relying party domain and that the work is a passkey, not Sign in with Apple.
Step 2: set up webcredentials and the AASA file
Have the agent add the Associated Domains capability, enter webcredentials: plus the fully qualified domain, and place a valid apple-app-site-association file at /.well-known/ on that domain. Do not let it invent entitlement strings or reuse applinks / appclips.
Step 3: register, assert and optionally offer AutoFill
Implement ASAuthorizationPlatformPublicKeyCredentialProvider with the relying party identifier, build a registration or assertion request from the server challenge, and present ASAuthorizationController. Adopt ASAuthorizationControllerDelegate and verify the credential with the server. For AutoFill, set textContentType to username and call performAutoFillAssistedRequests().
Step 4: review the SwiftUI around the sign-in screen
Run swiftui-pro on the screen that hosts the sign-in fields or the sheet, so layout and contrast stay current. Do not restyle system authorization UI beyond what Apple documents.
Tools compared (4)
| Tool | Best for | Agents (README) | Install (README) | License | Stars | Last push |
|---|---|---|---|---|---|---|
| Apple Docs MCP (kimsungwhee) | Look up Authentication Services, passkey APIs and associated-domain entitlements | Claude Code, Cursor, VS Code, Windsurf | claude mcp add apple-docs -- npx -y @kimsungwhee/apple-docs-mcp@latest | MIT | 1388 | 17 Mar 2026 ⚠ |
| sosumi.ai (NSHipster) | Pull Apple passkey and associated-domains docs as Markdown | any MCP host | npx -y mcp-remote https://sosumi.ai/mcp | MIT | 492 | 13 Nov 2026 |
| ApKI (Gucky) | Route the agent to official Apple developer resources | Codex, Claude Code | npx skills add https://github.com/Gucky/ApKI --skill apki | MIT | 2 | 3 Nov 2026 |
| swiftui-pro (twostraws) | Modern SwiftUI around the sign-in screen that hosts the passkey flow | Claude Code, Cursor, Codex, Gemini | npx skills add https://github.com/twostraws/SwiftUI-Agent-Skill --skill swiftui-pro | MIT | 6568 | 26 Oct 2026 |
⚠ = no push in the last 4 weeks.
Which one to pick
Official API lookup → Apple Docs MCP or Sosumi.
A short route into Apple's current developer resources → ApKI.
SwiftUI around the sign-in screen → swiftui-pro.
Axiom’s security pack (live at /skills/axiom) names passkeys among its topics; use it as a security review, not as a substitute for Apple’s passkey docs.
A prompt that keeps the agent honest
Code
Add passkeys so people can sign in to this iOS app without a password. Do not implement Sign in with Apple here; that is a separate request type. Add the Associated Domains capability with the webcredentials service for our relying party domain, and tell me what to put in the apple-app-site-association file at /.well-known/. Obtain a challenge from the server, then register or assert with ASAuthorizationPlatformPublicKeyCredentialProvider and ASAuthorizationController (set the delegate and presentation context provider, call performRequests()). Verify the registration or assertion with the server. For AutoFill, set the user name field’s textContentType to username and call performAutoFillAssistedRequests(). Do not invent the associated-domain service string or use applinks or appclips for this. Look up “Supporting passkeys”, “Public-Private Key Authentication”, ASAuthorizationPlatformPublicKeyCredentialProvider and “Supporting associated domains” in Apple's docs first.FAQ
- Are passkeys the same as Sign in with Apple?
- No. Passkeys are iCloud Keychain public-key credentials created per account with `ASAuthorizationPlatformPublicKeyCredentialProvider`. Sign in with Apple uses `ASAuthorizationAppleIDButton` and its own capability; that flow is covered in Sign in with Apple with AI agents. Apple documents that you can include additional assertion requests, such as Sign in with Apple, in the same `ASAuthorizationController` array, and handle those cases in the same delegate method.
- What associated domain service do passkeys need?
- `webcredentials`. Apple’s Supporting passkeys article says a registration or assertion request returns an error unless the app has an associated domain with that service type. Add the Associated Domains capability, list `webcredentials:<fully qualified domain>`, and host `apple-app-site-association` at `https://<domain>/.well-known/apple-app-site-association`. Do not use `applinks` (universal links) or `appclips` for this.
- How do I register a passkey or sign someone in?
- Obtain a challenge from the server. Create `ASAuthorizationPlatformPublicKeyCredentialProvider` with the relying party identifier, then a registration request (challenge, user name, user ID) or an assertion request (challenge). Present it with `ASAuthorizationController`, set the delegate and presentation context provider, and call `performRequests()`. Verify an `ASAuthorizationPlatformPublicKeyCredentialRegistration` or `ASAuthorizationPlatformPublicKeyCredentialAssertion` with the server. Registering with the same user ID overwrites the existing passkey on the user’s devices.
- How does AutoFill work with passkeys?
- Password AutoFill can suggest passkeys alongside passwords. Set the user name field’s `textContentType` to `username` and call `performAutoFillAssistedRequests()`. When the person taps the user name field, the system can suggest passkeys saved for the app.
- Which tools should the agent use first?
- Apple Docs MCP or Sosumi, so the agent opens “Supporting passkeys”, “Public-Private Key Authentication”, `ASAuthorizationPlatformPublicKeyCredentialProvider` and “Supporting associated domains” instead of inventing entitlements or treating passkeys as Sign in with Apple. Add swiftui-pro for the SwiftUI around the sign-in screen.