Skip to main content
Privy offers the ability to sign up and log users in using a passkey. This lets users access their account simply and securely.
Enable passkey authentication in the Privy Dashboard before implementing this feature.

Login with Passkey

To authenticate your users with Privy’s out of the box UIs, check out UI components here.
Use loginWithPasskey from the useLoginWithPasskey hook to trigger the passkey login flow.
passkey
string
Optionally prompt the user to sign in with a specific passkey credential.

Usage

Sign up with Passkey

Use signupWithPasskey from the useSignupWithPasskey hook to trigger the passkey signup flow.

Usage

Tracking Flow State

Track the state of the passkey flow via the state 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.
error
Error | null
The error that occurred during the passkey flow.

Callbacks

You can optionally pass callbacks into the useLoginWithPasskey and useSignupWithPasskey hooks to run custom logic after a successful login or signup, or to handle errors that occur during the flow.

onComplete

Parameters

User
PrivyUser
The user object returned after successful login or signup.”
isNewUser
boolean
Whether the user is a new user or an existing user.
wasAlreadyAuthenticated
boolean
Whether the user was already authenticated before the passkey flow.
loginMethod
'passkey'
The login method used to authenticate the user.
linkedAccount
LinkedAccount
The linked account if the user was already authenticated.

onError

Parameters

error
Error
The error that occurred during the passkey flow.

Resources

React starter repo

Get started with React and Privy.

Next.js starter repo

Get started with Next.js and Privy.

Whitelabel starter repo

Get started with a whitelabel Privy integration.