Enable passkey authentication in the Privy
Dashboard before implementing this feature.
- React
- React Native
Login with Passkey
To authenticate your users with Privy’s out of the box UIs, check out UI components here.
loginWithPasskey
from the useLoginWithPasskey
hook to trigger the passkey login flow.Optionally prompt the user to sign in with a specific passkey credential.
Usage
Sign up with Passkey
UsesignupWithPasskey
from the useSignupWithPasskey
hook to trigger the passkey signup flow.Usage
Tracking Flow State
Track the state of the passkey flow via thestate
variable returned by both the
useLoginWithPasskey
and useSignupWithPasskey
hooks.status
'initial' | 'error' | 'generating-challenge' | 'awaiting-passkey' | 'submitting-response' | 'done'
The current state of the passkey flow.
The error that occurred during the passkey flow.
Callbacks
You can optionally pass callbacks into theuseLoginWithPasskey
and useSignupWithPasskey
hooks to run custom logic after a successful login or signup, or to handle errors that occur during the flow.onComplete
Parameters
The user object returned after successful login or signup.”
Whether the user is a new user or an existing user.
Whether the user was already authenticated before the passkey flow.
The login method used to authenticate the user.
The linked account if the user was already authenticated.
onError
Parameters
The error that occurred during the passkey flow.