Auth0 WebAuthn Passkeys — Passwordless Authentication with Passkeys
DodaTech
Updated 2026-06-28
1 min read
In this tutorial, you'll learn about Auth0 WebAuthn. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
WebAuthn passkeys provide phishing-resistant authentication using biometric or PIN verification on user devices.
// Passkey registration in browser
async function registerPasskey() {
const registrationOptions = await fetch('/auth/webauthn/register/options', {
headers: { Authorization: `Bearer ${accessToken}` }
}).then(res => res.json());
const credential = await navigator.credentials.create({
publicKey: {
challenge: base64url.decode(registrationOptions.challenge),
rp: { name: 'ScanApp', id: 'scanapp.example.com' },
user: {
id: Uint8Array.from(registrationOptions.userId, c => c.charCodeAt(0)),
name: 'user@example.com',
displayName: 'User'
},
pubKeyCredParams: [{ type: 'public-key', alg: -7 }],
authenticatorSelection: {
authenticatorAttachment: 'platform',
residentKey: 'required',
userVerification: 'required'
}
}
});
await fetch('/auth/webauthn/register/complete', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ credential })
});
}
// Sign in with passkey
async function authenticateWithPasskey() {
const assertionOptions = await fetch('/auth/webauthn/login/options').then(res => res.json());
const assertion = await navigator.credentials.get({
publicKey: {
challenge: base64url.decode(assertionOptions.challenge),
allowCredentials: assertionOptions.allowCredentials,
userVerification: 'required'
}
});
const tokenResponse = await fetch('/auth/webauthn/login/complete', {
method: 'POST',
body: JSON.stringify({ assertion })
}).then(res => res.json());
return tokenResponse.access_token;
}
Passkeys replace passwords with device-bound cryptographic credentials that are resistant to phishing attacks.
← Previous
Auth0 Device Authorization Flow — OAuth 2.0 Device Flow for Auth0
Next →
Auth0 API Rate Limits — Optimizing Auth0 API Usage Within Rate Limits
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro