Live demo
Sign in without a password
This runs the published package against your own authenticator. Nothing is simulated: the assertion your device produces is verified by the same code the documentation describes.
01 / enrol
Choose a name
Anything at all. It is discarded when the process restarts.
02 / verify
Create the account
Your device offers Touch ID, Windows Hello, a phone, or a security key.
03 / return
Sign out, then in
Signing in asks for no username. The browser shows what it holds for this domain.
Live demo
No sessionWhat is running
Both halves, in full
const handler = demoPasskeys.handler({
basePath: '/api/passkey',
getSessionUserId: (req) => readSession(req),
onRegister: (_req, { user }) =>
({ 'set-cookie': createSessionCookie(user.id) }),
onLogin: (_req, { user }) =>
({ 'set-cookie': createSessionCookie(user.id) }),
});
export {
handler as GET, handler as POST,
handler as PATCH, handler as DELETE,
};configure({ baseUrl: '/api/passkey' });
// Create the account
await register({ username });
// Enter. No username needed.
await login();
// Offer passkeys in the browser's own
// autofill dropdown.
signInWithAutofill().then(refresh);Both files are reproduced in full on the examples page.
When it works here, the same twelve lines work in your application.