Technical
Mastering Passwordless Authentication with FIDO2 and WebAuthn
Didit Authentication includes 50,000 monthly active users, then costs $0.02 per additional active user per month at list price. A full ID check costs $0.33 and runs separately from passkey sign-in.

Contents
In this guide
Jump to the part you need.
This how-to is for teams shipping hosted passkey sign-in with WebAuthn in production, with a backend that verifies every token. We run passwordless sign-in through Didit Authentication: the first 50,000 active users each month are free, then $0.02 per active user per month, and a separate full ID check is $0.33. The caveat is scope: a passkey proves control of a registered credential, not who the person is.
Prices checked against the live Didit price feed on November 26, 2026.
| Item | Detail |
|---|---|
| Outcome | Hosted passkey sign-in, a second method the person can choose, and short-lived tokens verified on your server |
| Sign-in methods | Passkeys, email code, magic link, email and password, phone code, social, company single sign-on |
| Free allowance | First 50,000 active users each month |
| Price after the allowance | $0.02 per active user per month |
| Identity verification, run separately | Full ID check $0.33 per completed check: ID document $0.15, passive liveness $0.10, face match $0.05, device and IP $0.03 |
| Biometric Authentication, if run separately | $0.10 per Biometric Authentication check |
| Token lifetime | Access token up to 5 minutes, refreshed by the SDK |
| Main caveat | A passkey proves control of a registered credential, not who the person is; your backend makes the access decision |
Start free in the sandbox at business.didit.me, no sales call. If you want an AI assistant to wire the flow, connect Didit to an AI assistant through the Didit MCP server.
What FIDO2 and WebAuthn change, and what they leave open
FIDO2 is the specification family that lets an authenticator hold a private key. WebAuthn defines how a site requests a credential or an assertion. CTAP2 lets a client communicate with a roaming authenticator such as a security key. A platform authenticator is integrated with the device. During sign-in, the authenticator signs its authenticator data and a hash of the client data, which contains the challenge and origin.
WebAuthn binds the credential to a relying party ID. The server verifies the challenge, origin and relying party ID as part of the ceremony. Each sign-in uses a fresh challenge. A passkey may sync across devices or stay bound to one authenticator.
| Step | Registration | Sign-in |
|---|---|---|
| Server sends | A creation challenge, the relying party ID and a user handle | A fresh challenge and the relying party ID |
| Authenticator does | Generates a key pair, keeps the private key, returns the public key and a credential ID | Signs authenticator data and the client-data hash with the credential's private key |
| Server checks | Challenge, origin and relying party ID, then stores the public key against the account | Challenge, origin, relying party ID and the signature against the stored public key |
| What it shows | An authenticator was reachable at that moment | Control of the credential registered earlier |
In a hosted integration, the trust boundary sits in two places: Didit verifies the WebAuthn assertion on its sign-in page, and your backend verifies the access token Didit issues after sign-in. Your server does not run the ceremony itself.
Two things stay open. Enrollment is one: nothing in the protocol tells you that the person registering the credential is the account holder. Recovery is the other: a lost, reset or replaced authenticator needs a second path in, and that path is the weakest link in the flow.
We cover the first with identity verification, which runs as its own check beside hosted sign-in, and the second with a second sign-in method plus a step-up check before a sensitive action. A full ID check costs $0.33 per completed check. Authentication is free for the first 50,000 active users each month, then $0.02 per additional active user per month at list price. A separately run Biometric Authentication check costs $0.10. We run identity and fraud checks for 4,000+ companies.
Prerequisites
- A Didit account with a Sandbox application. Creating one 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 redirect URL and an allowed origin registered on the application.
- The publishable key from Authentication, Developers. In a sandbox application it starts with
pk_test_. - A decision on scope: hosted passkey sign-in alone, or a separate full ID check at $0.33 whose result your backend reads before granting access that requires verified identity.
Eight steps from sandbox to a verified hosted sign-in
- Open your sandbox application. In the Business Console, use the application switcher to select Sandbox, then open Authentication. A sandbox application accepts
http://localhostcallbacks and is never billed. A live application turns Authentication on from the Products page, and until it is on, every runtime route for that application returns404. - Register the callback and the origin. Open Authentication, Security and sessions, Redirect URLs and allowed origins, and add the two values below. We only return a person to a redirect URL you registered, character by character. The allowed origin lets the browser exchange the code with your application's Didit sign-in origin.
Sandbox redirect settings What Value Redirect URL http://localhost:3000/auth/callbackAllowed origin http://localhost:3000 - Turn on Passkeys and Email code. Open Authentication, Sign-in methods. A new application starts with every method off, and the hosted page offers only the methods you turn on. From code, email code can be enabled with
PUT methods/code/and{"enabled": true}at the management base below, using a full-access application key, an application key withauthenticationwrite access, or an owner-approveddidit:managementgrant with the required role. Social methods can require their own provider credentials.
The management base iscurl --fail-with-body --request PUT "${MANAGEMENT_BASE}methods/code/" \ -H "x-api-key: $DIDIT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"enabled": true}'https://apx.didit.me/auth/v2/organizations/{org_id}/applications/{application_id}/authentication/. The call answers{"name": "code", "enabled": true}.
Email code is a second method the person can choose on the hosted page when the passkey is not available. - Copy the publishable key. Open Authentication, Developers and copy the publishable key. It is public and it names your application's Didit sign-in origin. Never put the secret key in browser or mobile code: the code exchange is protected by PKCE instead of a client secret.
- Install the SDK and start a sign-in.
npm install @didit-protocol/auth
Click the button and enter an email address. The documented first sign-in uses Email code, and a first sign-in with an address that has no account creates one, because the default sign-up policy lets anyone sign up. The hosted page offers only the methods you enabled. Run passkey sign-in as a separate test once a sandbox account has an enrolled passkey. Your callback then exchanges the one-time code for the session's tokens.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(); // Sandbox diagnostic only: remove before production console.log(session.email, session.vendorData); window.location.replace(returnTo ?? "/"); } - Verify the access token on your server. Send the access token from
auth.getToken()in theAuthorizationheader, and check it on every protected request.
That snippet is the quickstart example: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; } }verifyTokenchecks the ES256 signature against your issuer's published keys, the issuer and the expiry. Production verification must enforce the full set of checks in your application: the ES256 signature against the keys published at the discovery document'sjwks_uri, the issuer, the application audience inaud, the expiry, and the access-token typeat+jwt, and it must reject a token whoseactis notnullunless the route accepts AI agents. The integration guide lists every check. Other languages use the server SDKs or any JWT library against the same JWKS. - Confirm the sign-in and subscribe to events. Open Authentication, Sign-ins. The sign-in is listed, and each sign-up, sign-in and failure also lands on the person's timeline. Subscribe a webhook destination to the types you need:
auth.signup,auth.login,auth.login_failed,auth.new_device,auth.mfa_changed,auth.account_locked. Events carry the sign-in method, IP address, device context and session ID. Failures and locks also carry a reason. - Run the end-to-end acceptance check. With Passkeys and Email code on, start from a sandbox account that already has an enrolled passkey, then prove three things in order: a sign-in with that passkey returns to your callback, your server accepts the resulting access token, and Authentication, Sign-ins lists the sign-in with method
passkey. Then repeat the run with Email code. This walkthrough covers hosted sign-in only; identity verification is a separate step, described below.
Passkey rollout test matrix
| Scenario | What to run | Expected result |
|---|---|---|
| First-time user | Open the hosted page with a new address and choose Email code | The default sign-up policy creates the account, the callback receives code and state, and the exchange returns tokens |
| Returning user | Same person in a new browser session, choose Passkeys | The passkey prompt signs the same person in, and the verified token carries the same sub |
| User without their authenticator | Same person on a device with no passkey, choose Email code | The sign-in completes with an emailed code; treat that session as lower trust and step up before a sensitive action |
| Revoked session before a sensitive action | Revoke the session, then call the protected action with the old access token | The token verifies until it expires, and GET /session/ returns 401, so the backend refuses the action |
Expected output
If you run the walkthrough as written, you should see:
- If you run the optional Email code management API request, the method returns
{"name": "code", "enabled": true}. - The callback arrives with
codeandstate, and the console logs the person's email andvendorData. That log is a sandbox diagnostic; remove it before production. - The callback exchanges the one-time code and receives an access token, an ID token, a refresh token,
token_typeBearer and asession_id. - The token response includes
expires_in, the remaining access-token lifetime in seconds. The docs show 299 as an example. verifyTokenreturns claims whereclaims.subis the person ID andclaims.vendor_datacarries the vendor data attached to the sign-in.- Authentication, Sign-ins lists the sign-in with its method, device and network.
Failure cases and recovery
| Response or symptom | Usual cause | Recovery |
|---|---|---|
400 {"error": "invalid_grant"} | The code is unknown, used or expired. The PKCE verifier does not match the original challenge, the redirect URI differs from the original request or is no longer registered, the person is blocked or their email is no longer verified, or the sign-in method was turned off. | Start a fresh sign-in with a fresh verifier. Reuse the original redirect URI for the exchange and confirm it is registered. If the failure persists, check the account and sign-in method. |
400 {"error": "invalid_client"} | client_id is not your application ID | Send the application ID, not the publishable key |
400 {"error": "mfa_required"} | The sign-in did not meet your MFA policy | Hosted pages handle MFA for you; on your own screens you handle this response |
| The passkey prompt never appears | The page is not served from the application's sign-in origin, or Passkeys is off for that application | Serve the passkey step from the sign-in origin or use the hosted page, and check Authentication, Sign-in methods |
| A returning person has no passkey on a new device | The credential stayed bound to one authenticator, or the person opened a browser profile without it | Have them choose email code, then ask for a step-up before a sensitive action |
| Token rejected after a key rotation | The cached JWKS does not hold the token's kid | Fetch the JWKS again when a kid is unknown, at most once a minute, and reject the token if the key is still missing |
| Tokens fail validation after custom domain activation | The custom domain replaces the default host as issuer, and the publishable key changes | New tokens name the new issuer. Update DIDIT_AUTH_ISSUER, or accept both issuers during the transition for up to five minutes. Access tokens issued under the old host fail GET /session/ until they are refreshed |
401 on a management route | The request carries no credential at all | Send a full-access application key, or an application key with authentication read for GET calls and write for changes, in the x-api-key header |
403 on a management route | A scoped key without the authentication scope, a key of another application, a grant limited to didit:verification, or a token from POST /programmatic/login | Use a full-access key of that application, a key with the right authentication scope, or an owner-approved didit:management grant within the person's role |
For supported social methods, Sandbox can use Didit's test app through didit_test when available. Live applications use their own provider credentials. See the management API docs.
Inputs and outputs
| Type | Item | Where it comes from or goes |
|---|---|---|
| Input | Sandbox or live application | Business Console application switcher |
| Input | Redirect URL and allowed origin | Authentication, Security and sessions |
| Input | Publishable key pk_test_ or pk_live_ | Authentication, Developers |
| Input | Enabled sign-in methods | Authentication, Sign-in methods, or the management API |
| Input | state and PKCE verifier | Your app, kept per attempt by the SDKs |
| Output | Authorization code | Returned to your redirect URL, valid for 60 seconds and once |
| Output | Access token, ID token, refresh token | POST {origin}/token/, exchanged by the SDK |
| Output | Verified claims | verifyToken on your server: sub and vendor_data |
| Output | Session record and events | Console timeline and auth.* webhooks |
Paid steps and review boundaries
Free. Sandbox testing is free and unlimited. The SDKs, the MCP server, the Workflow Orchestrator and Reusable KYC are included. Authentication is free for the first 50,000 active users each month.
Billed per completed check. A full ID check is $0.33 per completed check. The ID document check alone is $0.15, passive liveness $0.10, face match $0.05, device and IP analysis $0.03, active liveness $0.15, and a separately run Biometric Authentication check $0.10. AML screening is $0.20 per check and ongoing AML monitoring $0.07 per person per year. Active users beyond the free 50,000 each month are $0.02 each. Growth discounts these list rates by 4%, and Scale discounts them by 10%. Plan credit is added monthly and does not roll over.
Review boundaries. A verified access token identifies the signed-in account; it does not say what that account may do. Your backend still decides whether the account can reach the feature it asked for. Signing in does not approve a verification and does not authorize a payment, and your backend makes those decisions from each product's own result. It should check GET /session/ before a sensitive action, because an access token stays valid until it expires, within 5 minutes. A step-up only counts when your backend read the approved step-up itself. On sign-in events, the two event rule actions that sign a person out or block them are not active yet: a rule records them with the status DISABLED. A published price does not establish production availability, so check the product page and the docs for supported countries and methods.

Where identity verification fits when a feature needs a checked identity
Hosted passkey sign-in proves control of a registered credential. Identity verification is a separate step. When a feature needs a checked identity, run a full ID check as its own verification session: ID document $0.15, passive liveness $0.10, face match 1:1 $0.05 and device and IP analysis $0.03, billed at $0.33 per completed check.
Your backend must read the verification result before granting access that requires verified identity. A sign-in does not approve a verification, and a verification result does not sign anyone in. Store the decision next to the account, and gate the feature on it rather than on the passwordless sign-in.
Keep a second way in for the person who loses a device, and ask for a step-up before a payout, a new bank account or a contact change. A passkey proves control of a registered credential. Identity verification is a separate step, and the step-up only counts when your backend read the approved result itself.

Worked cost example
Take a consumer app that runs 12,000 full ID checks a month and signs in 65,000 active users a month, at list prices.
- Full ID checks: 12,000 × $0.33 = $3,960.00
- First 50,000 active users: 50,000 × $0.00 = $0.00
- Active users beyond the allowance: 15,000 × $0.02 = $300.00
- Total for the month: $3,960.00 + $0.00 + $300.00 = $4,260.00
On Growth, the 4% discount reduces the full ID check to $0.3168 and the additional active-user rate to $0.0192. The same month is 12,000 × $0.3168 = $3,801.60 plus 15,000 × $0.0192 = $288.00, so $4,089.60 of discounted usage before credits and fees. Add the monthly fee and subtract the monthly credit: $4,089.60 − $115.00 + $99.00 = $4,073.60. If you only sign people in and never run an ID check, the same 65,000 active users cost $300.00 for the month at list price.
Where Didit Authentication fits in the flow
Our Authentication product covers the sign-in itself: hosted pages in your brand, passkeys, email and phone codes, magic links, social and company single sign-on, MFA and sessions, plus auth.* webhooks. The Authentication overview and the sign-in methods page list every method.
Identity verification sits beside it for the features that need a checked identity, with a step-up before sensitive actions. Transaction monitoring and wallet screening sit after sign-in, when money moves. Every unit price is on didit.me/pricing, and the production architecture is in the integration guide.
Sources
- Didit docs: Authentication quickstart, first sign-in in 10 minutes
- Didit docs: Authentication overview
- Didit docs: sign-in methods
- Didit docs: integration guide, architecture and go-live
- Didit docs: tokens and JWKS
- Didit docs: set up Authentication by API
- Didit docs: Authentication events and webhooks
- Didit Authentication product page
- Didit pricing and pricing in the docs, read November 26, 2026
- Didit live price book, read November 26, 2026
- Didit MCP server
- W3C Web Authentication specification and FIDO Alliance FIDO2 specifications, referenced by name.
Next step: open the sandbox at business.didit.me, turn on Passkeys and Email code in your sandbox application, and run one hosted passkey sign-in, then a separate email-code sign-in, end to end. No sales call.
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
Alberto Rosas
Co-founder and CEO

Questions
Frequently asked questions
What is the difference between FIDO2, WebAuthn and a passkey?
FIDO2 is the specification family, WebAuthn is the browser API that creates and uses credentials, and a passkey is a credential that either syncs across a person's devices or stays bound to one device. You implement WebAuthn in the browser and the authenticator does the cryptography. We expose passkeys as a sign-in method, so the hosted page and the SDKs run the ceremonies for you.
Does Didit offer passkeys and other passwordless sign-in methods?
Yes. We offer passkeys, email code, magic link, phone code by SMS or WhatsApp, email and password, social sign-in and company single sign-on. The hosted page offers only the methods you turn on for that application, and magic links and company single sign-on run on the hosted pages.
Do people need a hardware security key to sign in with a passkey?
No. A passkey can live in a platform authenticator built into the device, and a FIDO2 security key is an external authenticator for the same WebAuthn ceremonies, reached over CTAP2. Our documented route is hosted passkey sign-in through Authentication. On Didit's hosted sign-in page, Didit verifies the WebAuthn assertion. Your backend verifies the access token Didit issues after sign-in.
How much does passwordless authentication cost on Didit?
The first 50,000 active users each month are free, then $0.02 per active user per month at list price. A full ID check, run separately from sign-in, is $0.33 per completed check, and sandbox testing is free and unlimited. Growth discounts these list rates by 4%, and Scale discounts them by 10%.
Is passwordless sign-in enough to satisfy KYC?
No. A passkey proves control of a registered credential, and a sign-in does not approve a verification. We keep the two separate: Authentication signs a person into your application, and identity verification produces its own result that your backend reads before it grants access to features that require a verified identity.
How long does a Didit access token last and how do I verify it?
Access tokens last at most 5 minutes and auth.getToken() refreshes them. The quickstart verifies with verifyToken, which checks the ES256 signature against your issuer's published keys, the issuer and the expiry; production verification also checks the application audience in aud, the token type at+jwt, and rejects a token whose act is not null unless the route accepts AI agents. The integration guide lists every check. Before a sensitive action, also call GET /session/, which fails at once if the session was revoked, went idle or expired.
Why is there no passkey button on my own sign-in screens?
Passkeys belong to your application's Didit sign-in origin, and the SDKs' passkey methods work only on pages served from that origin. If your screens run on another domain, send people to the hosted page for the passkey step. Passwords, email code, phone code, MFA and protection challenges can stay on your own screens.
What happens when the signing keys rotate?
Keys rotate every 30 days. We publish the next key one day before it starts signing and keep the previous key published for a day after it stops, and the OpenID Connect discovery document and the JWKS document are both cacheable for 5 minutes. Cache keys by kid; when a token names a key you do not have, fetch the JWKS again at most once a minute and reject the token if the key is still missing.
Can I enable sign-in methods from code instead of the console?
Yes, with the Authentication management API. Email code can be enabled with PUT methods/code/ and {"enabled": true}, using a full-access application key, an application key with authentication write access, or an owner-approved didit:management grant with the required role. Social methods can require separate provider credentials. A scoped key without that scope, a key of another application, or a token minted by POST /programmatic/login is refused with 403.
What should I do when a user loses their authenticator?
Turn on a second method such as email code before launch, so the person still has a way in. Treat that recovery session as lower trust and ask for a step-up, such as a selfie, before a payout, a new bank account or a contact change. The step-up only counts when your backend read the approved result itself.
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


