Passkeys using Client SDKs
Learn how to quickly add passkeys to your app using Authsignal’s Client SDKs and have complete control over the UI.
We recommend only enrolling passkeys after users have already enrolled with another authentication factor (like email OTP, SMS, TOTP, etc.).
Enable and configure passkeys in the Authsignal Portal
-
Navigate to the Authenticators section and click Set up Passkey.
-
Add the Relying Party ID in the next step. It’s the domain where your app is hosted (e.g.
example.com
). Then click Activate passkeys.For local development, we recommend creating a separate tenant. Add
localhost
as the Relying Party ID. -
Set the expected origins on the next screen.
Add the expected origins for any subdomains you’re using (e.g. https://auth.example.com
).
Defining the expected origins for your domain
For local development, it will be your localhost app url, e.g. http://localhost:3000
.
Add the expected origins for any subdomains you’re using (e.g. https://auth.example.com
).
Defining the expected origins for your domain
For local development, it will be your localhost app url, e.g. http://localhost:3000
.
Using passkeys on native mobile apps requires setting up an associated domain. You can find more detailed information on this in our Mobile SDK docs. Then for:
iOS: No additional expected origins needed - iOS uses associated domains instead.
Android: Add an expected origin value for your APK hash (e.g. android:apk-key-hash:YOUR_APK_HASH
).
Setting an expected origin value for your APK hash
You can obtain your app’s APK hash by running a signing report.
Creating a passkey
1. Backend - Generate enrollment token
In your app’s backend, track an action using Server SDKs or with a REST call to our Server API.
When tracking an action to create a passkey, the scope add:authenticators
must be specified if
the user is already enrolled with an authenticator - this includes another passkey.
In such cases you should ensure users are strongly authenticated with an existing method before creating the passkey. Learn more about authenticator binding.
2. Frontend - Create the passkey
In your app’s frontend, call the signUp
function in one of our Client SDKs, passing the token returned in step 1.
Authenticating with passkeys
1. Frontend - Sign in with passkey
In your app’s frontend, call the signIn
function in one of our Client SDKs:
Check out our best practice guides for web browsers and native mobile apps for tips on how to implement an optimal passkey UX and avoid leading users into dead ends.
2. Backend - Validate authentication
Pass the token returned by the Client SDK in step 1 to your backend, validating the result of the authentication server-side.
Using autofill (Web and iOS only)
This requires you to have an input field on your web page or app screen for the identifier (e.g. email address) which is used to login. When the input field is focused, the user will be able to select an existing passkey if one is available on their device.
1. Frontend - Enable passkey autofill
In your app’s frontend, call the signIn
function in one of our Client SDKs and set the autofill
param to true.
If the user focuses the input field and successfully activates their passkey, the Authsignal Client SDK will resolve with a token.
On Android you can achieve a similar UX by showing an input field and calling signIn()
when the
field is focused.
2. Backend - Validate result
Send the token returned by the Client SDK to your backend and validate the result of the sign-in attempt server-side.
Set your Relying Party ID to your production domain
You can run your web app locally on your production domain (e.g. example.com
) instead of using localhost - e.g. by editing your hosts file.
You will likely also need to use a self-signed development certificate to run your app locally on an https endpoint.