Passkin

Requiring a second step, and step-up

Status: built (2026-10-05). Tests: apps/auth-broker/tests/step-up.test.ts, tests/native.test.ts, tests/manage.test.ts. Passkin has always asked for a second factor — an authenticator app, a recovery code, a text (SMS.md) — of people who had set one up. Two things were missing, and they are what Auth0, Clerk and the others sell as "enforce MFA" and "step-up":

  1. A project can require a second step of everyone who signs in: mfa_policy: "required" — or an organization can require it of its members (require_mfa, ORGANIZATIONS.md).
  2. An application can ask for one at a single sign-in — acr_values — to protect a sensitive action ("confirm it is you before you move money"), and read in the token whether it happened.

What counts as "more than one factor"

Passkin says so in the token, and only when it knows:

Sign-in amr acr
password, emailed code or Google/GitHub, then an authenticator app or a recovery code ["password","otp","mfa"] multi-factor
the same, then a texted code ["password","sms","mfa"] multi-factor
the same, then a code by WhatsApp ["password","whatsapp","mfa"] multi-factor
a passkey (Passkin asks every passkey for user verification, so it is the device and the person) ["passkey"] multi-factor
Continue with Passkin, where the person used a passkey or a second factor at Passkin ID ["passkin","passkey","mfa"] / ["passkin","otp","mfa"] multi-factor
a first factor alone ["password"], ["google"]… absent
single sign-on (the organization's own identity provider) ["sso"] absent — Passkin cannot know what the provider asked of the person

acr is the OpenID PAPE value Auth0 and others already use: http://schemas.openid.net/pape/policies/2007/06/multi-factor. It is in the ID token, listed in discovery (acr_values_supported, and acr in claims_supported), and — like amr — on the tokens issued at the sign-in; a refreshed ID token carries neither.

Requiring it of everyone (mfa_policy)

PATCH /v1/manage/projects/:pid     { "mfa_policy": "required" }     # or "optional" (the default)

Dashboard: Settings → Require a second step for everyone. As code: mfa_policy in passkin.config (passkin plan/apply). When it is on:

  • A person who has a second factor is asked for it after every first factor (as before); a passkey needs none.
  • A person who has none gets no session and no code: they land on a page — "A second step is required" (en/ar/es/fr/fr) — that says to add a passkey, an authenticator app or a phone number to their Passkin ID, with a button to Passkin ID → Security and one to sign in again once done. Nothing is issued meanwhile (HTTP 403 on that page).
  • A Passkin session that was only one factor is not reused to get in: the silent "you are already signed in" path asks again. prompt=none answers login_required.
  • Existing sessions and refresh tokens are not ended when the policy is turned on — it applies from the next sign-in. To end them now, revoke sessions one at a time (POST /v1/manage/projects/:pid/sessions/:sid/revoke, MANAGEMENT-API.md); there is no "end every session" switch yet.
  • Single sign-on is exempt: an organization that signs in through its own identity provider is governed by that provider's policy (its MFA, its conditional access), and Passkin does not second-guess it.
  • A person must be able to meet it before they join. A new person on a project that requires it can sign in, and is then sent to set a factor up — they are not created in the project until they have one.

Asking for it at one sign-in (step-up)

Add acr_values to the authorization request:

GET /p/<pk>/authorize?…&acr_values=http://schemas.openid.net/pape/policies/2007/06/multi-factor&max_age=0&prompt=login

(acr_values=mfa is accepted too.) Passkin treats the ask as a requirement, not the voluntary preference the spec allows: it will not hand back a code without more than one factor. The person goes through exactly what the project-wide policy describes — asked for a factor they have, or sent to set one up. A session that was multi-factor is reused silently (prompt=none works and the ID token says acr); one that was not is not.

Check the token, never the request. Your server decides from the ID token's acr (and amr, auth_time): an acr equal to the value above, auth_time recent enough for the action. A request you built can be edited in the browser; the token cannot.

const claims = await verifyIdToken(idToken);
if (claims.acr !== "http://schemas.openid.net/pape/policies/2007/06/multi-factor" || Date.now() / 1000 - claims.auth_time > 300) {
  return redirectTo(`/authorize?...&acr_values=…&max_age=0&prompt=login`);   // step up, then try again
}

Protecting an API: the step-up challenge (RFC 9470)

The access token carries the same facts as the ID token: acr (when known to be more than one factor), amr and auth_time (RFC 9068 §2.2.1). A token that is refreshed says the same: the session remembers how the person authenticated (so a step-up is not lost after an hour). An API that wants more than a valid token for one operation answers with the standard challenge, and a client that understands it sends the person back to sign in again, more strongly:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="insufficient_user_authentication",
  error_description="A different authentication level is required",
  acr_values="http://schemas.openid.net/pape/policies/2007/06/multi-factor", max_age=300

An API for your own apps (verifyRequest):

import { createPasskinServer, MULTI_FACTOR, stepUp } from "@passkin/server";   // or "@passkin/nextjs/server"

const caller = await passkin.verifyRequest(request);           // userId, clientId, scopes, acr, amr, authTime
if (!caller) return new Response("Unauthorized", { status: 401 });
const again = stepUp(caller, { acr: MULTI_FACTOR, maxAge: 300 });   // null when the sign-in is strong and recent enough
if (again) return again;                                        // the 401 above, with only what is missing in it

An API for third parties (createResourceServer, OAUTH.md) — the same, per operation, with the RFC 9728 metadata pointer in the challenge:

export const POST = mcp.withAuth(handler, { scopes: ["write:orders"], authentication: { acr: MULTI_FACTOR, maxAge: 300 } });
// or: const checked = await mcp.verify(request, { authentication: { acr: MULTI_FACTOR } });  → caller.acr, caller.amr, caller.authTime

Only what is missing is asked for: a person whose sign-in is multi-factor but old gets max_age=300 alone. A service (a client_credentials token) has no person to ask and gets 403 access_denied.

On the web page side the session says how the person signed in, so a sensitive page can ask before showing the form:

const session = await passkin.getSession(request);             // session.acr, session.amr, session.authTime
if (session?.acr !== MULTI_FACTOR) redirect("/api/auth/signin?returnTo=/transfer&prompt=login&acr_values=mfa&max_age=0");
<PasskinSignInButton ... />                                    // React: signIn({ returnTo: "/transfer", prompt: "login", acrValues: "mfa", maxAge: 300 })
<passkin-sign-in-button return-to="/transfer" prompt="login" acr-values="mfa" max-age="300">Confirm it is you</passkin-sign-in-button>

@passkin/server's sign-in route passes acr_values and max_age on to Passkin.

Native sign-in (the phone's Google / Apple sheet)

The sheet is a first factor Passkin cannot ask more of — there is no page. So the token exchange refuses with interaction_required for a person who has a second factor, and for every person of a project that requires one: "sign in with the browser flow instead" (AppAuth, INTEGRATION.md §8), which can ask. An app should catch that error and fall back to the browser flow. (Before this, a person with a second factor could skip it through the native exchange: that was a gap, and it is closed.)

Not built

"Required for admins only" (the field exists in the settings type; an organization-role rule needs the role at sign-in time, which a project's sign-in does not have), a rule that applies only when the member acts in a given organization (the per-organization rule is built, but covers the member's every sign-in to the project), a time window ("ask again after 12 hours") beyond max_age, claims-parameter essential acr (claims_parameter_supported is false; acr_values is the way), an mfa_token flow like Auth0's (a person with a factor is asked on the hosted page; there is no API for an app to drive a challenge itself), a WebAuthn-only level (acr for "a passkey specifically", for the strictest actions).

Trusted devices: "Don't ask again on this device for 30 days"

Built 2026-10-07. Test: apps/auth-broker/tests/trusted-device.test.ts.

On the second-step page, a person may tick Don't ask again on this device for 30 days. The sign-in page then sets a cookie with a random token (__Host-passkin_td, HttpOnly, 30 days); Passkin keeps only its SHA-256 (trusted_devices), for that account. For 30 days a sign-in from that browser with a password or an email code goes straight through, without the second step — and the tokens say only what was used (amr has no mfa).

It is offered and honoured only where nothing requires the step: a project that requires a second step for everyone, an application asking for it (acr_values), or an organization that requires it of its members all ask every time, trusted device or not. Saying a sign-in was not them ("This wasn't me", which ends every session) forgets every trusted device of the account. Expired ones are removed by the scheduled maintenance.

Ready to try it?

Create a project — the dashboard fills these snippets in with your own keys.

Open the dashboard