Recommended: JavaScript SDK for React Native
While this SDK is still supported, we recommend using newer JavaScript SDK, which is optimized for React Native, but also comes with a host of other benefits.
Prerequisites
Before setting up passkeys, ensure you have:- A React Native project with Dynamic SDK already integrated
- A domain/website that you control (for hosting the required
.well-knownendpoints) - Access to your app’s bundle identifier and signing certificates
- For iOS: Apple Developer account and Xcode
- For Android: Android Studio and signing key information
Installation
Install the required package using your preferred package manager:- expo
- npm
- yarn
Shell
Post-Installation Steps
After installing thereact-native-passkey package, you need to link the native packages to your project:
For iOS
Shell
For Expo Projects
If you are using Expo, you may need to run a prebuild or create a new build:Shell
Shell
After running
expo prebuild, you’ll need to rebuild your app for the native modules to be properly linked.Configuration
Dynamic SDK Configuration
To create passkeys associated with the correct website, you must configure theappOrigin in the ReactNativeExtension:
OS Configuration
iOS
There are iOS-specific steps to configure Passkey support. If you have already set up an associated domain for your application, you can skip this step.Set Up an Associated Domain for Your Application
Follow the Apple documentation to associate a domain with your application. On your webserver, set up this route: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.
Android
The Android-specific configuration is similar to iOS. If you have already set up Digital Asset Links for your application, you can skip this step.Associate Your App with a Domain
Follow the Android documentation to associate a domain with your application. On your webserver, set up this route:Managing passkeys
Now that your application has correctly associated your domain with your application, you can register and authenticate using passkeys for both primary authentication (1FA) and multi-factor authentication (2FA).Register a passkey
The passkey module provides a method to trigger passkey registration. Here’s an example:Authenticate with passkeys (1FA)
You can use passkeys as the primary authentication method. Here’s how to implement passkey-based sign-in:Use passkeys for MFA (2FA)
For multi-factor authentication, you can use the following methods to list and authenticate with passkeys:dynamicClient.passkeys.get()- Retrieves all registered passkeys for the userdynamicClient.passkeys.authenticateMFA()- Uses a registered passkey for multi-factor authentication