Pre-selecting a specific passkey (allowCredentials)
If the user is already logged into their account, or they have presented a username/email in a two-step login flow, you can help them out by preselecting the passkey they should use to authenticate.
import { authenticatePasskey } from "@passlock/client";
// from your backendconst allowCredentials = [existingPasskeyId]const result = await authenticatePasskey({ allowCredentials, ... })Given that you already know their user ID (or claimed ID), you can look up the passkeys associated with the account and pass them to authenticatePasskey via the allowCredentials property.
This is conceptually similar to the excludeCredentials registration option.
Handle missing passkeys
Section titled “Handle missing passkeys”You can end up with a scenario in which a user has deleted a passkey locally but it’s still linked in your backend system. When you pass the missing passkey id via allowCredentials the local device will return an error indicating that no passkey with the given id can be found locally:
import { authenticatePasskey, isPasskeyNotFound } from "@passlock/client";
const result = await authenticatePasskey({ ... });
if (isPasskeyNotFound(result)) { // fall back to another method e.g. one-time code // or username/password + TOTP authentication}