# Browser routes

> The routes under /auth/ that the browser client and the elements call on the app's origin, through the app's proxy.

From `server/openapi.json` in tensile-tools/tensile-auth at commit `e66760d` (v0.4.1-7-ge66760d). The HTML page is https://auth.tensile.tools/docs/reference/api/browser.

The browser client and the elements call these routes on the app's own origin, and the app's proxy forwards them to the server. Refusals are RFC 9457 problems.

## /auth/activity

### GET /auth/activity

The person's own audit events and whether the audit chain verifies.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/approvals

### GET /auth/approvals

The signed-in person's pending agent approvals.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/approvals/{id}

One of the person's approvals.

Auth: The `__Host-session` cookie.

| Parameter | In | Type | Description |
|---|---|---|---|
| `id` (required) | path | `string` |  |

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/approvals/{id}/begin

Begin approving with a passkey: returns WebAuthn request options bound to the approval.

Auth: The `__Host-session` cookie.

| Parameter | In | Type | Description |
|---|---|---|---|
| `id` (required) | path | `string` |  |

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/approvals/{id}/deny

Deny an approval.

Auth: The `__Host-session` cookie.

| Parameter | In | Type | Description |
|---|---|---|---|
| `id` (required) | path | `string` |  |

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/approvals/{id}/finish

Finish approving with the passkey's receipt.

Auth: The `__Host-session` cookie.

| Parameter | In | Type | Description |
|---|---|---|---|
| `id` (required) | path | `string` |  |

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/client

### GET /auth/client/

The browser client's files.

Auth: None.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `string` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/dbsc

### POST /auth/dbsc/refresh

Refresh a device-bound session's short-lived cookie.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/dbsc/start

Bind the session to the device with Device Bound Session Credentials.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/email

### POST /auth/email/change

Change the email address.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/email/resend

Send the confirmation link again.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/me

### GET /auth/me

The signed-in person's session.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/passkey

### POST /auth/passkey/add/begin

Begin adding a passkey to the signed-in person's account.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/passkey/add/finish

Finish adding a passkey.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/passkey/credentials

List the signed-in person's passkeys.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/passkey/sign-in/begin

Begin a passkey sign-in: returns WebAuthn request options.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/passkey/sign-in/finish

Finish a passkey sign-in and start a session.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/passkey/sign-up/begin

Begin a passkey sign-up: returns WebAuthn creation options.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/passkey/sign-up/finish

Finish a passkey sign-up and start a session.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/passkey/step-up/begin

Begin a passkey step-up for the signed-in person.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/passkey/step-up/finish

Finish a passkey step-up.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/password

### POST /auth/password/add

Add a password to an account that has none.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/change

Change the password.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/password/confirm

The page an email confirmation link opens; it changes nothing on load.

Auth: None.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `string` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/confirm

Confirm an email address with the code from its link.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/forgot

Send a password reset link.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/password/link.js

The script of the email-link pages.

Auth: None.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `string` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/remove

Remove the password.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/password/reset

The page a reset link opens; it changes nothing on load.

Auth: None.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `string` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/reset

Set a new password with the code from a reset link.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/sign-in

Sign in with an email address and a password.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/sign-up

Sign up with an email address and a password.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/password/status

Whether the person has a password and a confirmed address.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/password/step-up

Step up with the password.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/recovery

### POST /auth/recovery/confirm

Confirm that the person saved the recovery codes.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/recovery/generate

Generate a new set of recovery codes.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/recovery/sign-in

Sign in with a recovery code, in recovery mode.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/recovery/sign-ins

Recent sign-ins with a recovery code.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/recovery/undo

Undo a recovery: revoke its session and what it changed.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/sessions

### GET /auth/sessions

The person's sessions and the agents delegated from them.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/sessions/revoke-others

Revoke every other session of the person.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/sessions/{id}/revoke

Revoke one of the person's own sessions and what is delegated from it.

Auth: The `__Host-session` cookie.

| Parameter | In | Type | Description |
|---|---|---|---|
| `id` (required) | path | `string` |  |

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/setup

### GET /auth/setup

What the preset asks the person to set up next.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/sign-out

### POST /auth/sign-out

Sign out: revoke the session in the cookie and clear it.

Auth: None.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

## /auth/totp

### POST /auth/totp/confirm

Confirm a TOTP enrolment with a code.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/totp/enroll

Begin enrolling a TOTP authenticator.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/totp/remove

Remove the person's authenticator app; needs a sign-in from the last 10 minutes.

Auth: The `__Host-session` cookie.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### GET /auth/totp/status

The person's own authenticator app: whether it is set up, confirmed, or locked.

Auth: The `__Host-session` cookie.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |

### POST /auth/totp/verify

Finish a sign-in with a TOTP code.

Auth: None.

Body: `object` as `application/json`, optional.

| Status | Meaning | Body |
|---|---|---|
| 200 | Done | `object` |
| default | A refusal, as an RFC 9457 problem | `Problem` |
