Passwordless login, built by hand
Magic links, passkeys and sessions on our own identity provider, replacing AWS Cognito.
InterfacesAPI SpecSections
API Spec Designed
- POST
/api/identity/v1/auth/magic-linksRequest 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/confirmExchange a magic-link token for a session (deliberate POST). Public
Body
{token}→200 {user, return_to}with the session cookie set. Errors:400invalid, expired or used token (one message for all three). - POST
/api/identity/v1/auth/email-codes/verifySign in with the 6-digit code from the same email. Public
Body
{email, code}→200 {user}with the session cookie set. Errors:400wrong or expired code,429after 5 tries. - POST
/api/identity/v1/passkeys/registration-optionsWebAuthn options to register a new passkey. Signed in
→
200PublicKeyCredentialCreationOptions; the challenge is stored server-side for 5 minutes. - POST
/api/identity/v1/passkeysVerify the registration and save the passkey. Signed in
Body
{name, response}→201 {passkey, recovery_codes?}(codes only with the first passkey). Errors:400verification failed. - GET
/api/identity/v1/passkeysList 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:403withcode: reauthentication_required. - POST
/api/identity/v1/auth/passkeys/authentication-optionsWebAuthn options to sign in with a passkey (no email needed). Public
→
200PublicKeyCredentialRequestOptions with an empty allow-list (discoverable credentials). - POST
/api/identity/v1/auth/passkeys/verifyVerify a passkey assertion and create a session. Public
Body
{response}→200 {user}with the session cookie set. Errors:400invalid or replayed assertion (audited). - POST
/api/identity/v1/recovery-codesRegenerate 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/verifySign in with a single-use recovery code. Public
Body
{email, code}→200 {user, prompt: "add_passkey"}. Errors:400,429. - GET
/api/identity/v1/sessionsList 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/sessionsSign out everywhere else. Signed in
→
200 {revoked}; the current session is kept. - POST
/api/identity/v1/auth/reauthenticationStart re-authentication for a sensitive action. Signed in
Body
{method: passkey|email_code}→200WebAuthn options, or202after sending a code. - POST
/api/identity/v1/auth/reauthentication/verifyFinish re-authentication; valid for 5 minutes. Signed in
Body
{response}or{code}→200 {reauthenticated_until}. The next access token carriesreauth_at, which other services check. - POST
/api/identity/v1/me/email-changeAsk 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/confirmConfirm the new email address. Signed in
Body
{token}→200 {user}. - GET
/api/identity/v1/admin/migration-reportUsers migrated from Cognito vs not yet migrated. Admin
→
200 {migrated, pending, cutoff_at}. - POST
/api/identity/v1/me/restoreRestore my account. Signed in during the 30 days
→
200 {user}. Errors:409 not_deactivated. - POST
/api/identity/v1/admin/service-clients/{clientId}/secretsAdd a secret. Admin, session only
→
201 {secret_id, secret}, the secret shown once. Errors:409 too_many_secretswhen two are already active. - DELETE
/api/identity/v1/admin/service-clients/{clientId}/secrets/{secretId}Retire a secret. Admin, session only
→
204. Errors:409 last_secretunless?emergency=true. - GET
/api/identity/v1/admin/service-clientsClients with their secrets' created and last-used dates. Admin
Never returns a secret.
Notes
IDENTITY-V2-E8-01No new endpoints.GET /session,POST /tokenandGET /jwkskeep their contract, so no other service or app changes.GET /auth/loginand/auth/callbackare removed in IDENTITY-V2-E8-08.IDENTITY-V2-E8-09No new endpoints. The gateway checks theOriginheader on cookie-authenticated writes; API-key requests are exempt from CSRF checks because they carry no ambient credentials.IDENTITY-V2-E8-10No new endpoints: composesGET /api/identity/v1/passkeysandDELETE …/passkeys/{passkeyId}(IDENTITY-V2-E8-04),POST /api/identity/v1/me/email-change(IDENTITY-V2-E8-07) andGET /api/identity/v1/sessions(IDENTITY-V2-E8-06). RemovesPOST /api/identity/v1/me/password-change(MVP1), with a deprecation note in the changelog.IDENTITY-V2-E8-11DELETE /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.