Passkey Login
Add login with passkey option.
Determine login options for a user
We recommend a two-step login process, where a user enters their email on the first page and is then shown the best login option for them, but you can implement this on a single page as well. Some browsers and devices don't support passkeys yet, so we recommend always checking for passkey support before offering a passkey login.
The following code accepts an email and determines if the user should log in with Passage or with a different method. The decision is based on whether the user has a passkey registered with Passage and their current browser support passkeys.
Passkey login and exchange for session token
If it is determined that a user can use a passkey for login, we will provide a special experience for that.
Assuming you make a TokenStore setTokens
method from the previous guide, once a user logs in with Passage they will automatically be given a legacy session token for your application.
To conduct a passkey login, you will simply call the login function in PassageJS and the rest will be handled for you. An example function might look like this:
Try it out!
That's it! Take a look at a complete registration and login flow with Passkey Flex.
Last updated