A sample iOS app demonstrating passkey signup, login, and logout using Auth0's Native Login and the Auth0.swift SDK.
- Xcode 16+
- iOS 16.6+ device (passkeys require a physical device or a simulator with iCloud Keychain)
- Apple Developer account (for Associated Domains capability)
- Auth0 account with a Native Application
- Open Xcode and create a new project: App template
- Set Interface to SwiftUI, Language to Swift
- Name the project
NativePasskeys - Copy the Swift source files from this repo into the project
- In Xcode, go to File > Add Package Dependencies
- Enter:
https://github.com/auth0/Auth0.swift - Set the version to 2.12.0 or later
- Add the
Auth0andJWTDecodelibraries to your target
- Update
Auth0.plistwith your Auth0 Client ID and custom domain - In the Auth0 Dashboard:
- Enable passkeys on your database connection
- Enable the Passkey grant type on your application (Advanced Settings > Grant Types)
- Add your Team ID and Bundle Identifier under Device Settings (Advanced Settings > Device Settings > iOS)
- Set up a custom domain
- Setting up the callbacks in the app --> https://YOUR_AUTH0_DOMAIN/ios/YOUR_BUNDLE_IDENTIFIER/callback,YOUR_BUNDLE_IDENTIFIER://YOUR_AUTH0_DOMAIN/ios/YOUR_BUNDLE_IDENTIFIER/callback <-- in this case the HTTPS:// is the important one, and needs to have the custom domain.
- In Xcode, select your target > Signing & Capabilities
- Add the Associated Domains capability
- Add:
webcredentials:YOUR_AUTH0_CUSTOM_DOMAIN
Or update NativePasskeys.entitlements directly with your custom domain.
Build and run on a physical iOS device (or a simulator with iCloud Keychain configured).
NativePasskeys/
├── NativePasskeysApp.swift # App entry point, root navigation
├── LoginView.swift # Email field, Login and Sign Up buttons
├── HomeView.swift # User greeting, ID token display, Logout
├── AuthViewModel.swift # Passkey auth logic + ASAuthorization delegate
├── Auth0.plist # Auth0 Client ID and domain
└── NativePasskeys.entitlements # Associated Domains
Both signup and login follow a three-step flow:
- Challenge — The app requests a WebAuthn challenge from Auth0 (
/passkey/registerfor signup,/passkey/challengefor login) - Credential — Apple's
ASAuthorizationControllercreates or retrieves a passkey on-device - Token exchange — The app sends the credential back to Auth0 (
/oauth/token) and receives access, ID, and refresh tokens
The Auth0.swift SDK handles the API calls. Apple's ASAuthorizationPlatformPublicKeyCredentialRegistration and ASAuthorizationPlatformPublicKeyCredentialAssertion types conform directly to the SDK's SignupPasskey and LoginPasskey protocols — no manual JSON serialization required.
Copyright 2026 Okta, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0