Configure passkeys for Expo
Passkeys are a secure, passwordless authentication method that use biometrics and a physical device to authenticate users. This guide shows you how to configure passkeys for your Expo application.
Enable passkeys
To use passkeys, first enable the strategy in the Clerk Dashboard.
Configure passkeys
Use the following tabs to configure your passkeys for iOS or Android.
Get your App ID Prefix and Bundle ID from Apple
To get your App ID Prefix and Bundle ID, follow these steps:
- Navigate to the Apple Developer dashboard.
- Under Certificates, IDs and Profiles, select Identifiers.
- In the top-right, select the dropdown and select App IDs.
- Select the App ID you want to configure passkeys for. You'll be redirect to the Review your App ID Configuration page.
- At the top of the page, you'll see your App ID Prefix and Bundle ID. Save these values somewhere secure.
Set up your associated domain file in the Clerk Dashboard
- In the Clerk Dashboard, navigate to the Native Applications page.
- Select the iOS tab.
- Select Add iOS App.
- Paste the App ID Prefix and Bundle ID that you copied in the previous step.
- Select Add App.
- On the right-side, save your Frontend API URL somewhere secure.
Update app.json in your Expo app
- In your app's
app.jsonfile, under theiosobject, add theassociatedDomainsproperty as shown in the following example. Replace<YOUR_FRONTEND_API_URL>with the Frontend API URL value that you saved in the previous step.
{
"expo": {
//...existing properties
"plugins": [
[
"expo-build-properties",
{
"ios": {
"deploymentTarget": "16.0" // iOS Support passkeys from version iOS 16+
}
}
]
],
"ios": {
//...existing properties
"associatedDomains": [
"applinks:<YOUR_FRONTEND_API_URL>",
"webcredentials:<YOUR_FRONTEND_API_URL>"
]
}
}
}Set up your Android app links in the Clerk Dashboard
- In the Clerk Dashboard, navigate to the Native Applications page.
- Select the Android tab.
- Select Add Android app.
- Fill out the form with the following information:
- The
namespace(This guide uses the default value:android_app) - Your Android app's package name
- The
SHA256 certificate fingerprints. If you don't know where to find theSHA256 certificate fingerprints, see the Expo docs.
- The
- After submitting the form, you can verify that your
assetlinks.jsonfile is properly associated with your app by using Google's Statement List Generator and Tester. - On the right-side, save your Frontend API URL somewhere secure.
Install expo-build-properties in your Expo application
npm install expo-build-propertiespnpm add expo-build-propertiesyarn add expo-build-propertiesbun add expo-build-propertiesUpdate app.json in your Expo application
- In your app's
app.jsonfile, underandroid, add theintentFiltersproperty as shown in the following example. Replace<YOUR_FRONTEND_API_URL>with the Frontend API URL value that you saved in the previous step.
{
"expo": {
"plugins": [["expo-build-properties"]],
"android": {
//...existing properties
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "<YOUR_FRONTEND_API_URL>"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
}
}
}Install @clerk/expo-passkeys
Run the following command to install the @clerk/expo-passkeys package:
npm install @clerk/expo-passkeyspnpm add @clerk/expo-passkeysyarn add @clerk/expo-passkeysbun add @clerk/expo-passkeysPrebuild Expo project
Run the following command to prebuild your Expo project:
npx expo prebuildUpdate your <ClerkProvider>
Pass the passkeys object to the __experimental_passkeys property of your <ClerkProvider> component, as shown in the following example:
import { ClerkProvider } from '@clerk/clerk-expo'
import { Slot } from 'expo-router'
import { tokenCache } from '@clerk/clerk-expo/token-cache'
import { passkeys } from '@clerk/clerk-expo/passkeys'
export default function RootLayout() {
return (
<ClerkProvider
tokenCache={tokenCache}
publishableKey={publishableKey}
__experimental_passkeys={passkeys}
>
<Slot />
</ClerkProvider>
)
}Usage
To learn how to use passkeys in your Expo application, such as creating, deleting, and authenticating users with passkeys, see the custom flow guide.
Feedback
Last updated on