Developer's Guide to Secure WebAuthn for Passwordless Onboarding
Add passkeys with Didit Authentication: enable the passkey method, register a redirect URL, sign in on the hosted page, verify the ES256 token on your server. First 50,000 monthly active users are free.

Contents
In this guide
Jump to the part you need.
This guide fits developers who need passkeys and passwordless sign-up in a web app without running a WebAuthn server themselves. Didit Authentication ships the passkey method with no setup, and the first 50,000 active users each month are free, then $0.02 per active user per month. The caveat: the passkey belongs to the application's Didit sign-in origin, so where you serve your sign-in page decides where it works.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Item | What you get |
|---|---|
| Sign-in methods | Passkeys, email code, magic link, password, phone code, Google, Microsoft, Apple, GitHub and organization SSO |
| Passkey setup | None. One switch turns the method on |
| Where the ceremony runs | Your application's Didit sign-in origin: https://<slug>.auth.didit.me live, https://<slug>.sandbox.auth.didit.me in sandbox, or a verified custom domain |
| Tokens | ES256 access token valid at most 5 minutes, an ID token and a refresh token that rotates on every use |
| Price | First 50,000 active users each month free, then $0.02 per active user per month |
| Optional identity check at sign-up | Full ID check $0.33, AML screening $0.20 |
| Sandbox | Free and unlimited. Authentication is on for every sandbox application, and each sign-in method starts off |
Start free in the sandbox at https://business.didit.me/ with no sales call. For AI assistants and coding agents, connect Didit through the MCP server at https://didit.me/developers/mcp/. Every price quoted on this page is listed on https://didit.me/pricing/.
What WebAuthn does in a passwordless onboarding flow
WebAuthn is the W3C Web Authentication specification. Three parts take part in every ceremony: the relying party, which is your application or the Didit sign-in origin acting for it; the user agent, which is the browser; and the authenticator, which is the platform or security key that holds the key pair. The private key never leaves the authenticator. Your side keeps the public key and the credential ID.
Two ceremonies matter. Registration runs through navigator.credentials.create(): the server sends a challenge, the authenticator creates a key pair, and the client returns the public key with an attestation statement. Authentication runs through navigator.credentials.get(): the server sends a fresh challenge, the authenticator signs it with the private key, and the client returns an assertion your server verifies against the stored public key.
Two details break more implementations than anything else. A challenge must be unique for every ceremony and must be unusable once it has been answered, or a captured response can be replayed. The relying party ID must match the configured relying-party domain for the sign-in origin, so a credential registered for one relying party domain cannot be presented to an unrelated origin.
With Didit Authentication you do not run either ceremony yourself. Passkeys are a sign-in method, they belong to your application's Didit sign-in origin, and the hosted page handles registration and assertion. Your work is configuration, the redirect, and verifying the token on your backend.

Prerequisites
- A Didit account with a Sandbox application. Creating an account is free, and every Sandbox application has Authentication turned on.
- Node.js 20 or later, and a web app you can run on
http://localhost:3000. - A device with a platform authenticator or a security key, so a real passkey ceremony can run.
- For production, an HTTPS domain you will use as your sign-in origin, or a verified custom domain.
Step-by-step setup
Step 1: Open your sandbox application
In the Business Console, use the application switcher to select your Sandbox application, then open Authentication. A Sandbox application accepts http://localhost callbacks and is never billed. A Live application turns Authentication on from the Products page.
Step 2: Register your callback and origin
Open Authentication, then Security and sessions, then Redirect URLs and allowed origins, and add both values. Didit returns a person only to a redirect URL you registered, matched character by character.
| What | Value |
|---|---|
| Redirect URL | http://localhost:3000/auth/callback |
| Allowed origin | http://localhost:3000 |
Step 3: Turn on the passkey method
Open Authentication, then Sign-in methods, and turn on Passkeys. Add Email code as well, so a person without a passkey can still get in. A new application starts with every method off, and the hosted page offers only the methods you turn on.
You can set the same switch from your own code with an API key of the application that carries the authentication scope. Set MANAGEMENT_BASE to https://apx.didit.me/auth/v2/organizations/{org_id}/applications/{application_id}/authentication/:
curl --fail-with-body --request PUT "${MANAGEMENT_BASE}methods/passkey/" \
-H "x-api-key: $DIDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'
The endpoint answers with the method as it now stands. The documented email code call answers {"name": "code", "enabled": true}, and the passkey call answers in the same shape with passkey as the name. Methods that are always on answer {"enabled": "always_on"} instead.
Step 4: Copy your publishable key
Open Authentication, then Developers, and copy the Publishable key. In a Sandbox application it starts with pk_test_. The publishable key is public and names your application's sign-in origin. The secret key never belongs in browser or mobile code, and no Didit secret belongs in browser or mobile code in this flow.
Step 5: Install the SDK and start a sign-in
Install the package, then start the hosted sign-in from your button and finish it on your callback page. This is the runnable example from the Authentication quickstart.
npm install @didit-protocol/auth
import { createDiditAuth } from "@didit-protocol/auth";
export const auth = createDiditAuth({
publishableKey: "pk_test_...",
redirectUri: "http://localhost:3000/auth/callback",
});
// Your sign-in button
export async function onSignInClick() {
await auth.signIn({ returnTo: "/dashboard" });
}
// Run once on http://localhost:3000/auth/callback
export async function onCallbackPage() {
const { session, returnTo } = await auth.handleRedirectCallback();
console.log(session.email, session.vendorData);
window.location.replace(returnTo ?? "/");
}
Click the button. Because you turned Passkeys on, the hosted page offers a passkey button next to the email code. When the person registers or uses a passkey, Didit runs the ceremony on your sign-in origin and returns the browser to your callback with a one-time code, which the SDK exchanges for the session's tokens. A first sign-in with an address that has no account creates one, because the default sign-up policy lets anyone sign up.
If you build your own screens instead (sign_in_ui set to own), remember that passkeys belong to the sign-in origin. The SDKs' passkey methods work only on pages served from that origin, so on another domain send people to the hosted page for passkeys. Magic links also run on the hosted pages only.

Step 6: Verify the access token on your server
Send the access token from auth.getToken() to your backend in the Authorization header and verify it there on every protected request.
import { verifyToken } from "@didit-protocol/auth/server";
export async function authenticate(request: Request) {
const header = request.headers.get("authorization") ?? "";
const token = header.startsWith("Bearer ") ? header.slice(7) : "";
try {
const claims = await verifyToken(token, { publishableKey: process.env.DIDIT_PUBLISHABLE_KEY });
return { personId: claims.sub, vendorData: claims.vendor_data };
} catch {
return null;
}
}
verifyToken checks the ES256 signature against your issuer's published keys, the issuer and the expiry. Access tokens last at most 5 minutes, and auth.getToken() refreshes them for you. Other languages verify the same token with the server SDKs or any JWT library.
Step 7: Check the live session before a sensitive action
A token stays valid until it expires, within 5 minutes. Before a payout, a new bank account or an email change, call the session route on your sign-in origin and act on the answer your backend reads itself.
curl --fail-with-body "${DIDIT_AUTH_ISSUER}/session/" \
-H "Authorization: Bearer $ACCESS_TOKEN"
The route fails at once when the session was revoked, went idle or expired, when the person was blocked, or when the session no longer meets your MFA policy. Before a risky action you can also ask for a step-up check, such as a selfie, and act only on an approved step-up.
Step 8: Watch sign-ups and sign-ins in the console
Open Authentication, then Sign-ins. Every sign-up, sign-in and failure appears on the person's timeline next to their verifications and transactions. Subscribe to the auth.* webhooks so your server hears about auth.signup, auth.login and auth.new_device, and use the console to block, restore access or sign people out when you need to.
Expected output
After step 3, one enabled method comes back. After step 5, the code exchange at POST {issuer}/token/ returns this shape:
{
"access_token": "eyJhbGciOiJFUzI1NiIs...",
"id_token": "eyJhbGciOiJFUzI1NiIs...",
"refresh_token": "N4yZTl6y24YKYq77X_SO...",
"token_type": "Bearer",
"expires_in": 299,
"session_id": "c9abf6cc-2d64-4bf2-b31e-a4d09a070ab1"
}
In the console, the sign-in is listed under Authentication, then Sign-ins, with the method the person used.
Inputs and outputs
| Input or output | Where it appears | Rule |
|---|---|---|
redirect_uri | Sign-in request and code exchange | Must match a registered redirect URL exactly |
state | Sign-in request and callback | Up to 512 characters, checked on the callback |
code_challenge | Sign-in request | Base64url SHA-256 of the PKCE verifier, exactly 43 characters |
code_challenge_method | Sign-in request | S256 only |
code | Callback | Works once, exchanged within 60 seconds |
code_verifier | Code exchange | Kept by your app, sent with the code |
access_token | Code exchange | ES256 JWT, at most 5 minutes, verified on every request |
id_token | Code exchange | Carries the optional nonce you sent |
refresh_token | Code exchange | Rotates on every use |
expires_in | Code exchange | Seconds left on the access token |
session_id | Code exchange | Used with the session check before sensitive actions |
Failure cases and recovery
| Failure | What you see | Recovery |
|---|---|---|
| Redirect mismatch | The person is not returned to your app | Register the exact URL, port included, then start the sign-in again |
| Code exchange fails | 400 {"error": "invalid_grant"} | The code is unknown, used, older than 60 seconds, or the verifier or redirect URL does not match, or the method was turned off. Start a new sign-in |
| Second factor missing | Step mfa_required with challenge and factors | Send a TOTP or recovery code, or use a passkey |
| No authenticator enrolled | Step mfa_enrollment_required with challenge and uri | Enroll the authenticator with POST mfa/setup/ |
| Bot protection challenge | Step protection_required with challenge and methods | Run the challenge your policy asks for, then continue |
| Identity check required | Step verification_required with verification_url | Send the person to the URL, valid 30 minutes. The code follows an approved check |
| No passkey offered | The hosted page shows only your other methods | Turn Passkeys on. On your own domain, send people to the hosted page, because passkeys belong to the sign-in origin |
| Unknown signing key | Your verifier has no key for the token's kid | Fetch the JWKS again, at most once a minute, and reject the token if the key is still missing |
| Custom domain activated | Old access tokens fail the session check | Update DIDIT_AUTH_ISSUER, or accept both issuers until older tokens expire within 5 minutes |
Security rules the specification leaves to you
- Use the Didit sign-in origin for passkeys and follow Didit's configured relying-party settings. Do not move the ceremony to an unrelated domain. Didit configures the origin for you, and a verified custom domain replaces the default host as the issuer.
- Check
stateon the callback, and keep PKCE withS256. There is no client secret in this flow, so the verifier is what protects the code exchange. - Verify the access token on every protected request: ES256 signature against the JWKS, then
iss,aud,expandtyp: at+jwt. Reject a token whoseactis notnullunless the route accepts AI agents. - Cache keys by
kid. Keys rotate every 30 days, Didit publishes the next key one day before it signs with it and keeps the previous key for one day after. - Give people more than one way in. Turn on email code, a magic link or phone code next to passkeys, and point people who lose an authenticator at a method you trust.
- Treat attestation and assertion differently. Attestation proves what the authenticator is during registration. Assertion proves presence and possession of the private key at every sign-in, and it is the one you always verify.
- For the riskiest actions, do not rely on the token alone. Check the live session, and ask for a step-up check before a payout or a bank account change.
Adding an identity check to passwordless onboarding
Signing in does not prove who the person is. If your onboarding needs a real identity behind the passkey, turn on verification at sign-up. Didit runs the check, and a sign-in returns verification_required with a verification_url until the check is approved, after which the code follows. The identity verification product sits on the public price list with every other module.
A full ID check is $0.33 and has three parts in one flow: the ID document at $0.15, passive liveness at $0.10 plus face match 1:1 at $0.05, and device and IP analysis at $0.03. AML screening adds $0.20 per check against 1,300+ lists, and ongoing AML monitoring is $0.07 per person per year.

Signing in never approves a verification and never authorizes a payment. Your backend makes those decisions from each product's own result, which is why the verification result and the token are read separately.
What passwordless onboarding costs on Didit
Authentication is priced per active user per month. The first 50,000 active users each month are free, and every active user after that is $0.02. A full ID check at sign-up is $0.33 on top, and the sandbox is free and unlimited on every plan.
Worked example: 120,000 active users a month, and 8,000 new sign-ups a month each verified with a full ID check.
- Active users billed: 120,000 minus 50,000 free = 70,000. 70,000 x $0.02 = $1,400.00.
- ID document: 8,000 x $0.15 = $1,200.00.
- Passive liveness: 8,000 x $0.10 = $800.00.
- Face match 1:1: 8,000 x $0.05 = $400.00.
- Device and IP analysis: 8,000 x $0.03 = $240.00.
- Full ID checks: $1,200.00 + $800.00 + $400.00 + $240.00 = $2,640.00, which is 8,000 x $0.33.
- Total at list price: $1,400.00 + $2,640.00 = $4,040.00 a month.
On the Scale plan the same month is $1,400.00 x 0.90 = $1,260.00 for active users and $2,640.00 x 0.90 = $2,376.00 for identity checks. The Scale plan fee is $299.00 a month with $350.00 of monthly credit, so read the net figure on the pricing page and in the pricing docs before you commit to a number.
Paid steps and review boundaries
- Free: the sandbox, the MCP server, the Workflow Orchestrator, Reusable KYC, and the first 50,000 active users each month.
- Paid per unit: active users after the allowance at $0.02 per active user per month, a full ID check at $0.33, AML screening at $0.20, ongoing AML monitoring at $0.07 per person per year, and phone codes at the carrier price plus $0.02.
- Review boundary: your backend decides access from the verified token and the live session. Your team reviews verification results, AML hits and transaction alerts in the console, where it can also block, restore access or sign a person out.
4,000+ companies run identity and fraud checks on Didit across 220+ countries, with SOC 2 Type 2 and ISO/IEC 27001:2022 certification. Authentication is new, so set the method up in a sandbox application first and prove the full flow before you turn it on in a live application.
Sources
- Didit docs: Authentication overview
- Didit docs: Authentication quickstart
- Didit docs: Authentication integration guide
- Didit docs: Sign-in methods
- Didit docs: Tokens and JWKS
- Didit docs: Set up Authentication by API
- Didit docs: Authentication events and webhooks
- Didit docs: Server SDKs
- Didit pricing page and pricing docs
- Didit MCP server
- W3C, Web Authentication: An API for accessing Public Key Credentials, https://www.w3.org/TR/webauthn-2/, read November 26, 2026
Next step: create a free account at https://business.didit.me/, open your Sandbox application and turn on Passkeys. Sandbox testing is free, there is no sales call, and the whole flow above runs on localhost.
Try it
Try this in the sandbox
Run the check this guide describes, free.
The product this post is about, taken from its topic. Run it free in the sandbox.
Author
Alejandro Rosas
Co-founder and CTO

Questions
Frequently asked questions
What is WebAuthn and how is it different from a password?
WebAuthn is the W3C Web Authentication specification. It replaces a shared secret with a public and private key pair, where the private key never leaves the authenticator and the server stores only the public key. A password can be copied from a breach and replayed. A WebAuthn credential is scoped to the relying party origin and cannot be presented to an unrelated origin, and the private key stays in the authenticator.
Do I have to build the WebAuthn server myself if I use Didit?
No. Passkeys are a sign-in method in Didit Authentication with no setup, and Didit runs the registration and assertion ceremonies on your application's sign-in origin. You register a redirect URL, turn the method on, and verify the access token on your backend. If you need the ceremonies on your own screens, you take on every intermediate step yourself.
How much does passwordless sign-in cost with Didit?
The first 50,000 active users each month are free, and each active user after that is $0.02 per month. A full ID check at sign-up adds $0.33, and AML screening adds $0.20 per check. Sandbox testing is free and unlimited.
Where is the passkey private key stored?
On the authenticator: a platform authenticator such as Touch ID or Windows Hello, or a hardware security key. The private key never reaches Didit or your server, and the public key and credential ID are what the relying party keeps. That is why a breach of your database does not expose a passkey sign-in.
Which domain do passkeys work on?
A passkey belongs to one sign-in origin, which is https://<slug>.auth.didit.me for a live Didit application, the sandbox equivalent in sandbox, or your verified custom domain. The SDKs' passkey methods work only on pages served from that origin, so on your own domain elsewhere you send people to the hosted page for passkeys.
What happens when someone loses their authenticator?
They sign in with another method you enabled, such as an email code, a magic link or a phone code, then register a new passkey. Having a fallback method turned on is what keeps a lost device from becoming a locked account. You can also block, restore access or sign a person out from the console.
How long does a Didit access token last and how do I verify it?
An access token is an ES256 JWT valid for at most 5 minutes, and auth.getToken() refreshes it for you. Verify it on your server with verifyToken from @didit-protocol/auth/server or any JWT library, checking the signature against the JWKS plus iss, aud, exp and typ: at+jwt. Before a sensitive action, also check the live session, because a revoked session fails at once.
Can I require an ID check before someone gets a passkey?
Yes. Turn on verification at sign-up, and the sign-in returns verification_required with a verification_url that is valid for 30 minutes. The one-time code follows only after the check is approved. A full ID check costs $0.33 including document, biometrics and device analysis.
Can I use my own sign-in screens instead of the hosted page?
Yes, set sign_in_ui to own and use the SDKs' headless methods or the JSON endpoints. Your screens then handle mfa_required, mfa_enrollment_required, protection_required and verification_required. Passkeys still belong to the sign-in origin, and magic links run on the hosted pages only.
What does WebAuthn not protect against?
It does not tell you whether the person is who they claim to be, and it does not authorize a payment. It proves possession of a private key bound to one origin. Identity verification, AML screening and transaction monitoring cover the rest, and your backend makes those decisions from each product's own result.
Compliance built in
Audited, certified and attested.
We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center
- Regulation encoded into your flows
Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.
- Ready for AMLR
Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.
- Tested in Spain's Treasury sandbox
Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.
- Audited, not self-declared
iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.
Your obligations · 3 regions
SOC 2 Type 2
ISO 27001
iBeta Level 1 and Level 2
EU regulator attestation
FSM youth protection
GDPR
EBA remote onboarding
MiCA compatible
FIDO Alliance member
- AMLREU AML Regulation ready
Integration · Didit MCP
Run Didit from your own AI agent
Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.
- Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
- Run investigationsAsk why a session was declined, review cases, search people and companies.
- Change rulesCreate payment rules, test them on past data and switch them on.
- Pull reportsAsk for numbers, exports or the audit log.
Didit Academy


