Overview
Passkeys in the Dynamic Swift SDK provide secure, passwordless authentication using biometrics or device credentials. Users can use passkeys as their primary login method (1FA) or as a second factor to enhance account security (2FA). To use passkeys in your iOS app, your website domain must grant credential access to the mobile app so passkeys can be created associated with the website domain. This allows users to seamlessly use the same passkeys across both your app and website.Prerequisites
Before setting up passkeys, ensure you have:- Dynamic SDK initialized in your iOS project (see Installation Guide)
- A domain/website that you control (for hosting the required
.well-knownendpoints) - Access to your app’s bundle identifier and signing certificates
- Apple Developer account with Xcode configured
App Configuration
There are a few steps to configure passkey support. If you have already set up an associated domain for your application, you can skip to Managing Passkeys.Set Up an Associated Domain
Follow the Apple documentation to associate a domain with your application. On your webserver, set up this route:XXXXXXXXXX with your team identifier and YYY.YYYYY.YYYYYYYYYYYYYY with your bundle ID (e.g., H123456789.com.example.mobileApp):
Add Associated Domains Capability in Xcode
- Open your project in Xcode
- Select your app target
- Go to Signing & Capabilities
- Click + Capability and add Associated Domains
- Add your webcredentials domain (replace
yourdomain.comwith your actual domain):
You can validate your Apple App Site Association (AASA) configuration using the Branch AASA Validator. This tool tests your domain against Apple’s requirements and helps ensure your Universal Links and passkey setup is properly configured.
SDK Configuration
Configure theappOrigin in your SDK initialization to associate passkeys with your domain:
Managing Passkeys
Now that your application has correctly associated your domain, you can register and authenticate using passkeys.Sign In with Passkey
Use passkeys as the primary authentication method:Register a New Passkey
After authentication, users can register passkeys for future sign-ins:List User Passkeys
Retrieve all passkeys registered for the authenticated user:Delete a Passkey
Remove a passkey from the user’s account:Complete Example
Here’s a complete SwiftUI example showing passkey authentication and management:Troubleshooting
Common Issues
Passkey registration fails- Verify your associated domain is correctly configured
- Check that the
apple-app-site-associationfile is accessible athttps://yourdomain.com/.well-known/apple-app-site-association - Ensure the JSON contains your correct team ID and bundle identifier
- Validate your AASA file using the Branch AASA Validator
- The user may not have any passkeys registered yet
- Ensure the user is authenticated before attempting passkey sign-in
- Verify
appOriginin SDK configuration matches your webcredentials domain exactly - Check that both use the same protocol (https://)
Using Passkeys for MFA
Passkeys can also be used as a second factor for multi-factor authentication. Once you’ve completed the configuration above, see the MFA Guide for details on using passkeys as a 2FA method.What’s Next
Now that you have passkeys configured:- MFA Guide - Use passkeys as a second factor for multi-factor authentication
- Authentication - Learn about other authentication methods
- API Reference - Complete passkey API documentation