Products · Identity V2

Passwordless login, built by hand

Magic links, passkeys and sessions on our own identity provider, replacing AWS Cognito.

Planned, not builtModule 9 of 15

InterfacesAPI SpecSections

API Spec Designed

  • POST/api/identity/v1/auth/magic-links

    Request a sign-in email. Public

    Always answers the same way. Body {email, return_to?} → 202 {message: "Check your email"} whether or not the account exists, in constant time. Errors: 429 (generic).

  • POST/api/identity/v1/auth/magic-links/confirm

    Exchange a magic-link token for a session (deliberate POST). Public

    Body {token} → 200 {user, return_to} with the session cookie set. Errors: 400 invalid, expired or used token (one message for all three).

  • POST/api/identity/v1/auth/email-codes/verify

    Sign in with the 6-digit code from the same email. Public

    Body {email, code} → 200 {user} with the session cookie set. Errors: 400 wrong or expired code, 429 after 5 tries.

  • POST/api/identity/v1/passkeys/registration-options

    WebAuthn options to register a new passkey. Signed in

    → 200 PublicKeyCredentialCreationOptions; the challenge is stored server-side for 5 minutes.

  • POST/api/identity/v1/passkeys

    Verify the registration and save the passkey. Signed in

    Body {name, response} → 201 {passkey, recovery_codes?} (codes only with the first passkey). Errors: 400 verification failed.

  • GET/api/identity/v1/passkeys

    List my passkeys. Signed in

    → 200 {data: [{id, name, created_at, last_used_at, backed_up}]}.

  • PATCH/api/identity/v1/passkeys/{passkeyId}

    Rename a passkey. Signed in

    Body {name} → 200 {passkey}.

  • DELETE/api/identity/v1/passkeys/{passkeyId}

    Remove a passkey (needs recent re-authentication). Signed in

    → 204. Errors: 403 with code: reauthentication_required.

  • POST/api/identity/v1/auth/passkeys/authentication-options

    WebAuthn options to sign in with a passkey (no email needed). Public

    → 200 PublicKeyCredentialRequestOptions with an empty allow-list (discoverable credentials).

  • POST/api/identity/v1/auth/passkeys/verify

    Verify a passkey assertion and create a session. Public

    Body {response} → 200 {user} with the session cookie set. Errors: 400 invalid or replayed assertion (audited).

  • POST/api/identity/v1/recovery-codes

    Regenerate recovery codes; the old set stops working. Signed in

    → 201 {codes[10]}, shown once. Needs recent re-authentication.

  • POST/api/identity/v1/auth/recovery-codes/verify

    Sign in with a single-use recovery code. Public

    Body {email, code} → 200 {user, prompt: "add_passkey"}. Errors: 400, 429.

  • GET/api/identity/v1/sessions

    List my active sessions with device and last active time. Signed in

    → 200 {data: [{id, device, approx_location?, last_seen_at, current}]}.

  • DELETE/api/identity/v1/sessions/{sessionId}

    Revoke one session. Signed in

    → 204.

  • DELETE/api/identity/v1/sessions

    Sign out everywhere else. Signed in

    → 200 {revoked}; the current session is kept.

  • POST/api/identity/v1/auth/reauthentication

    Start re-authentication for a sensitive action. Signed in

    Body {method: passkey|email_code} → 200 WebAuthn options, or 202 after sending a code.

  • POST/api/identity/v1/auth/reauthentication/verify

    Finish re-authentication; valid for 5 minutes. Signed in

    Body {response} or {code} → 200 {reauthenticated_until}. The next access token carries reauth_at, which other services check.

  • POST/api/identity/v1/me/email-change

    Ask to change my email (confirmation goes to the new address). Signed in

    Body {new_email} → 202. Needs recent re-authentication. A notice goes to the old address.

  • POST/api/identity/v1/me/email-change/confirm

    Confirm the new email address. Signed in

    Body {token} → 200 {user}.

  • GET/api/identity/v1/admin/migration-report

    Users migrated from Cognito vs not yet migrated. Admin

    → 200 {migrated, pending, cutoff_at}.

  • POST/api/identity/v1/me/restore

    Restore my account. Signed in during the 30 days

    → 200 {user}. Errors: 409 not_deactivated.

  • POST/api/identity/v1/admin/service-clients/{clientId}/secrets

    Add a secret. Admin, session only

    → 201 {secret_id, secret}, the secret shown once. Errors: 409 too_many_secrets when two are already active.

  • DELETE/api/identity/v1/admin/service-clients/{clientId}/secrets/{secretId}

    Retire a secret. Admin, session only

    → 204. Errors: 409 last_secret unless ?emergency=true.

  • GET/api/identity/v1/admin/service-clients

    Clients with their secrets' created and last-used dates. Admin

    Never returns a secret.

Notes

  • IDENTITY-V2-E8-01 No new endpoints. GET /session, POST /token and GET /jwks keep their contract, so no other service or app changes. GET /auth/login and /auth/callback are removed in IDENTITY-V2-E8-08.
  • IDENTITY-V2-E8-09 No new endpoints. The gateway checks the Origin header on cookie-authenticated writes; API-key requests are exempt from CSRF checks because they carry no ambient credentials.
  • IDENTITY-V2-E8-10 No new endpoints: composes GET /api/identity/v1/passkeys and DELETE …/passkeys/{passkeyId} (IDENTITY-V2-E8-04), POST /api/identity/v1/me/email-change (IDENTITY-V2-E8-07) and GET /api/identity/v1/sessions (IDENTITY-V2-E8-06). Removes POST /api/identity/v1/me/password-change (MVP1), with a deprecation note in the changelog.
  • IDENTITY-V2-E8-11 DELETE /api/identity/v1/me (signed in, session only) now deactivates. Body {confirm: "DELETE"} → 202 {deletes_at}. With {confirm: "DELETE", now: true} it deletes at once, as in MVP1.

Coming Soon...

Full inputs, constraints, error codes and sample requests and responses for each endpoint will appear here when this module's design is finalized.