chadtmiller.com/monolith
An atproto PDS
0
0
# OAuth: what the authorization pages show
[`OAUTH.md`](OAUTH.md) covers the authorization page and the error page
as far as a client and the API see them: when each answers, what the
`__authorizeData`, `__sessions` and `__errorData` statements hold, and what
each API call takes and answers. It leaves "the rest of a page" to the
server. This page covers that rest: what a person sees on each page, what
each control does, which API call it makes, and how the pages are built and
served.
## Sources
*This section is informative.*
`atproto/oauth.md`, "Authorization Interface", and `atproto/permission.md`
for what each scope allows. The reference's own pages are not a source.
What they show is not compared, only what a person's actions on them send
to the API and where the browser ends up ("How it is checked").
## How the pages are built
The pages are one Svelte 5 app in `web/`, built by Vite into `web/dist`,
with `web/dist/email.html`, the emails' HTML part (`EMAIL.md`, "The
message"). `web/AGENTS.md` covers how it is laid out and styled.
`pds-server` embeds the build when it is compiled, so the `pds` binary
serves the pages with nothing beside it: no Node, no files on disk. A
build of `pds` without `web/dist` fails and says to build `web/` first.
The authorization page, the passkey page (`PASSKEYS.md`) and the error
page answer the HTML `OAUTH.md` and `PASSKEYS.md` give them, and these too:
- In `<head>`, `<link rel="stylesheet">` for each stylesheet of the
build's entry, `<script type="module" src>` for its script, and `<link
rel="icon">` naming an icon among the build's files, so the browser asks
for no `/favicon.ico`. Their URLs are under `/oauth/assets/` (below).
- `<html lang="en">`, `<meta charset="utf-8">`, and `<meta
name="viewport" content="width=device-width,initial-scale=1">`.
- `<main id="app">`, holding `<noscript>This page needs
JavaScript.</noscript>`. The app draws itself into it.
- One inline `<script>`: the `window["<name>"]=JSON.parse("…");`
statements. No other inline script, and no `style` attribute or `<style>`
element in the HTML or anywhere the app draws.
Each of these pages answers with these headers, besides those `OAUTH.md`
gives it:
| Header | Value |
| --- | --- |
| `Content-Security-Policy` | `default-src 'none'; script-src 'self' 'sha256-<hash>'; style-src 'self'; img-src 'self' https: data:; connect-src 'self'; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'`, where `<hash>` is the base64 SHA-256 of that page's inline script's text |
| `X-Frame-Options` | `DENY` |
| `X-Content-Type-Options` | `nosniff` |
| `Referrer-Policy` | `same-origin`: the API's `Referer` check (`OAUTH.md`) needs the page's whole URL on its own origin, and a client is sent none |
**Assets.** `GET /oauth/assets/<name>` answers the file `<name>` of the
build, for each file Vite writes under `web/dist/assets` and nothing else.
The answer is `200`, with:
- the file's bytes;
- `Content-Type` by its extension: `.js` `text/javascript`, `.css`
`text/css`, `.svg` `image/svg+xml`, `.woff2` `font/woff2`, `.png`
`image/png`;
- `Cache-Control: public, max-age=31536000, immutable`;
*Note:* each name carries a hash of the file.
- `X-Content-Type-Options: nosniff`.
`HEAD` answers the same with no body. Any other name is `404`, and so is
any other method. The asset routes cost no rate limit (`OAUTH.md`, "Rate
limits").
## Every page
- Every page shows the server's host as the browser has it
(`location.host`) at its top.
*Note:* so a person can see whose page this is.
- Text is English, in sentence case, and every error is written as a
sentence ending in a full stop.
- Each view has one `<h1>`.
- Each view has at most one primary button.
- The pages follow the browser's colour scheme
(`prefers-color-scheme`), light or dark. Every text colour reads at
4.5:1 or better on what it is drawn on, in both schemes.
- At a width of 360 CSS pixels, nothing runs past the edge of the screen:
the page never scrolls sideways.
- Every field and button has an accessible name: the names below, which
the harness uses to find them. A field's error is joined to it by
`aria-describedby`. An error the page shows is in a `role="alert"`
element. Focus is visible on everything that takes it.
- When a view appears, focus goes to its first empty field. If the view
has no empty field, focus goes to its primary button, or to its first
button when it has no primary one, or to its heading when it has no
button.
- **Busy.** While an API call is on its way, or the browser is asking for
a passkey, the button that started it has `aria-busy="true"` and every
button of the view is disabled. When the call is answered, or the
browser is done, the view goes on.
- The app calls the API as `OAUTH.md` says, with `x-csrf-token` from the
`csrf-token` cookie and `credentials: "same-origin"`. It sends nothing
to any other origin, and asks for nothing from any other origin but the
account pictures and the client's logo.
- When a call answers a `url`, the app sends the browser there with
`location.assign`. It does this even if the URL carries an `error`.
## The authorization page
The page has four views. The first one it shows depends on its data:
1. **Consent**, when `__authorizeData.selectedDid` names an account in
`__sessions` whose `loginRequired` is false.
2. **Sign in**, when there is a `loginHint`: the identifier is filled
with it and read-only (`readonly`).
*Note:* the client asked for that account, and the reference's page
lets no other be typed there.
3. **Choose an account**, when `__sessions` has any account.
4. **Sign in**, empty, in all other cases.
### Sign in
| Control | Accessible name | Does |
| --- | --- | --- |
| heading | `Sign in` | |
| text field, `autocomplete="username webauthn"` | `Handle or email` | offers the device's passkeys in its autofill (below) |
| password field, `autocomplete="current-password"` | `Password` | |
| checkbox, unchecked by default | `Remember this account on this device` | |
| primary button, submits the form | `Sign in` | `sign-in` with `{locale: "en", identifier, password, remember}` |
| button, when the browser has WebAuthn (`window.PublicKeyCredential`) | `Sign in with a passkey` | ends the autofill's asking (below); `passkey-options` with `{}`; then `navigator.credentials.get()` with its `options`; then `passkey-sign-in` with `{locale: "en", credential, remember}`, `credential` the browser's credential as its `toJSON()` gives it (`PASSKEYS.md`, "Signing in") |
| button | `Back`, when this view was reached from another view; else `Cancel` | `Back`: shows the view it came from. `Cancel`: `reject` with `{}`. |
The form submits with Enter. Neither field may be left empty: an empty
field is shown as one that needs filling, and nothing is sent. A passkey
needs neither field: `Sign in with a passkey` sends what they hold
nowhere.
**Its layout.** The fields and the checkbox, then the ways in: `Sign in`,
the whole width; under it a rule with `or` in its middle, and every other
way to sign in under that, each a button the whole width, `Sign in with a
passkey` the first; then `Back` or `Cancel`, centred, drawn as a link, not
as a way in. The `or` is not read out (`aria-hidden`). Where the browser
has no WebAuthn and there is no other way, there is no rule.
*Note:* a way to sign in that comes later is one more button under the
rule.
**Autofill.** When the view appears with an identifier that may be typed
(no `loginHint`), and the browser offers passkeys in autofill
(`PublicKeyCredential.isConditionalMediationAvailable()` answers `true`),
the page asks for a passkey with `navigator.credentials.get()` with
`__passkeyOptions` and `mediation: "conditional"`, calling nothing first:
the browser then lists the device's passkeys for the server among the
identifier field's suggestions. One chosen is `passkey-sign-in` with
`{locale: "en", credential, remember}`, `remember` as the checkbox is then,
and its answer leads where a passkey sign-in's does (below), but that the
browser giving no credential shows no alert. Pressing `Sign in with a
passkey` ends that asking (an `AbortSignal`) before its own: a browser asks
for one passkey at a time.
What the `sign-in` answer leads to:
| Answer | The page |
| --- | --- |
| `200` | shows **Consent** for the answer's `account`, holding its `ephemeralToken` if it has one. The account joins the accounts the page knows (**Choose an account**). |
| `401` `second_authentication_factor_required` | shows **Email code** |
| `400` | alert `Wrong handle, email or password.` Both fields keep what was typed, and focus goes to the password. |
| `429` | alert `Too many tries. Try again in <n> minutes.` `<n>` is `Retry-After` in minutes, rounded up. When `<n>` is 1 it reads `in 1 minute`. |
| `507` | alert `The server is out of space. Try again later.` |
| anything else, or no answer | alert `Something went wrong. Try again.` |
What a passkey sign-in leads to:
| Answer | The page |
| --- | --- |
| the browser gives no credential (`navigator.credentials.get()` fails: no passkey, cancelled, timed out) | alert `No passkey was used.`, and no `passkey-sign-in` is sent |
| `200`, with a `loginHint` the answer's `account` is not (its handle, DID or email, handle and email without regard to case) | alert `That passkey is for another account.` |
| `200` | as `sign-in`'s `200` |
| `400` | alert `That passkey did not sign in. Try again, or use your password.` |
| `507` | as `sign-in`'s |
| anything else from either call, or no answer | alert `Something went wrong. Try again.` |
A passkey never leads to **Email code** (`PASSKEYS.md`, "passkey-sign-in").
### Email code
| Control | Accessible name | Does |
| --- | --- | --- |
| heading | `Check your email` | |
| text, under the heading | `We sent a sign-in code to the email address of <handle or email as typed>.` | |
| text field, `autocomplete="one-time-code"` | `Code` | |
| primary button | `Sign in` | `sign-in` again, with the same `identifier`, `password` and `remember`, and `emailOtp` set to the code as typed, trimmed |
| button | `Back` | shows **Sign in** as it was left |
The answers lead where they do from **Sign in**, except a `400`. A `400`
here shows the alert `Wrong code. Use the code in the latest email.`
### Choose an account
| Control | Accessible name | Does |
| --- | --- | --- |
| heading | `Choose an account` | |
| one button for each account the page knows, in order of handle | `Continue as @<handle>` | for an account of `__sessions`: if its `loginRequired` is false, **Consent** for it; else **Sign in**, with the identifier filled with its handle and the checkbox checked. For an account signed in on this page: **Consent** for it, holding its `ephemeralToken` if it has one |
| button | `Another account` | **Sign in**, empty |
| button | `Cancel` | `reject` with `{}` |
The accounts the page knows are those of `__sessions`, and each account
signed in on this page since it loaded, remembered or not, once. Each
shows its `name` when it has one, then `@<handle>`, with its `picture`
when it has one.
### Consent
| Control | Accessible name | Does |
| --- | --- | --- |
| heading | `Allow access` | |
| primary button | `Allow` | `consent` with `{did, scope}`: `did` is the account's DID, and `scope` is `__authorizeData.scope` exactly. If this sign-in gave an `ephemeralToken`, the call carries `Authorization: Bearer <ephemeralToken>`. |
| button | `Deny` | `reject` with `{}`, carrying `Authorization: Bearer <ephemeralToken>` as `Allow` does when the account has one, as the reference's page does |
| button | `Back`, when this view was reached from another view; else `Another account` | **Choose an account**, signing nothing out, as the reference's page does (its `Back` from consent lists the account just signed in, remembered or not, and continuing as it makes no new `sign-in`) |
| disclosure (`<details>`) | `Technical details` | a list of the scope's tokens as they are written, each in `<code>`, in the scope's order; under an `include:` token, a list of the scope strings its set grants (`OAUTH-PERMISSION-SETS.md`, "What a set grants"), each in `<code>`, in their order |
The view says who is asking and for which account:
- **The client.** A loopback client is shown as `An app on your
device`. Any other client is shown by its `client_name`, or by its
`client_id`'s host when it has no `client_name`. In both cases the
client's host is shown under the name, and the client's `logo_uri` is
shown beside it when there is one. The client's `tos_uri` and
`policy_uri`, when given, are links named `Terms` and `Privacy policy`.
They open in a new tab with `rel="noopener noreferrer"`.
- **The account**: `name`, `@<handle>` and `picture`, as **Choose an
account** shows them.
- **What it asks for**: a list (`<ul>`), one row (`<li>`) for each kind
of thing asked, not one for each token: tokens of a kind are merged
into one row, and what a broader token covers is not said again. Each
row has a heading (`<h2>`) and a sentence, in plain words for someone
who knows nothing of atproto: no NSID, method or DID shows outside
`Technical details` and a permission set's row, but a space's owner
whose handle does not verify (below). A permission set
(`OAUTH-PERMISSION-SETS.md`) the scope includes has a row of its own,
which shows the set as the reference's page does: its own title and
detail, written by the app's author, and what it grants. Everything
else is said in words that come from the scope alone, and the space
types' declarations, so they work for any app's lexicons. The rows, in
this order, the riskiest first, each only when the scope has a token of
it:
| Row | Heading | Sentence | From |
| --- | --- | --- | --- |
| 1 | `Full access` | `Read and change all your data, upload files and act as you on other services, as an app password can.` | `transition:generic` |
| 2 | `Identity` | `Change your handle, and take over your account's identity, which could move your account elsewhere.` with `identity:*`; else `Change your handle.` | `identity:*`, `identity:handle` |
| 3 | `Account` | `<Account clauses>.` | `account:…`, `transition:email` |
| 4 | `Direct messages` | `Read and send your Bluesky direct messages.` | `transition:chat.bsky` |
| 5 | `<Space heading>` | `<Space clauses>` | the scope's `space:` tokens, a row for each space they name (below), in the order the scope first names it |
| 6 | the set's title, or else its NSID | the set's detail; or else, for a set with a title, its NSID; or else none. Then **What it grants** (below) | each `include:` token, a row of its own, in the scope's order |
| 7 | `All your data` | `<Actions> all your data.` | `repo:` tokens of collection `*`, unless the scope has `transition:generic` |
| 8 | `Your data in <app>`, one row for each app, in the order the scope first names it | `<Data clauses>` | the other `repo:` collections, unless the scope has `transition:generic` |
| 9 | `Uploads` | `Upload <kinds>.` | `blob:…`, unless the scope has `transition:generic` |
| 10 | `Other services` | `Act as you on <services>.` | `rpc:…`, unless the scope has `transition:generic` |
| 11 | `Permission` | the token, in `<code>` | each other token the server keeps but an `include:` or a `space:`, a row of its own, in the scope's order |
| 12 | `Who you are` | `See which account is yours.` | `atproto`, always |
A space here is a `space` permission's `spaceType`, `authority` and
`skey`, each as given or by its default (`OAUTH-SCOPES.md`, "Spaces"):
the tokens naming the same three are one row, which says all they ask
between them. These rows come from the scope and from
`__authorizeData.spaces` and `spaceHandles` (`OAUTH-SCOPES.md`, "On the
authorization page"), not from the token's rewritten scope; and
`transition:generic`, which allows nothing of a space, hides none of
them.
A set's grant is what its permissions grant with the `include:`'s
audience (`OAUTH-PERMISSION-SETS.md`, "What a set grants"); the page works
it out from `__authorizeData.permissionSets`, as the server does. It is
said in the set's row alone: the other rows come from the scope's other
tokens, and `transition:generic` hides no set's row. In a set's row:
- **The title and detail** are `title:lang`'s `en`, or else its first key
that begins `en-`, or else `title`; likewise `detail`. A set has a title
(a detail) when that gives a string that is not empty. Each is shown
whole, as plain text, never markup; an NSID in their place is shown as
it is written, as plain text too.
- **What it grants** is a disclosure (`<details>`) after the sentence,
closed when the view appears, its summary `Details`. It holds the
sentence `The application requests the permissions necessary to perform
the following actions on your behalf:`, then the grant's tables below
(`<table>`, each with a header row of `<th>`), each only when the set
grants something of its kind. For a set that grants nothing, it holds
the sentence `Asks for nothing this server grants.` alone.
After the tables, each space of the grant's `space` permissions, in the
order the grant first names it, as a heading (`<h3>`), its
`<Space heading>`, and a paragraph (`<p>`) after it, its `<Space
clauses>.`, as row 5 says them.
| Table | Header | Its rows (`<tr>` in `<tbody>`) |
| --- | --- | --- |
| calls | `Call`, `Towards` | each method of the grant's `rpc` permissions, once for each audience it is asked towards: the audiences sorted, and each audience's methods sorted. `Call` is the method, in `<code>`. `Towards` is in the first row of each audience alone, its cell spanning that audience's rows (`rowspan`): `Any service` for `*`; `Bluesky App services` for an audience beginning `did:web:api.bsky.app#`; `Bluesky Chat services` for one beginning `did:web:api.bsky.chat#`; `A service controlled by <host>` for any other `did:web:<host>#…`; or else the audience, in `<code>` |
| data | `Data`, `Create`, `Update`, `Delete` | each collection of the grant's `repo` permissions, once, sorted. `Data` is the collection, in `<code>`. Each action's cell holds a check (Lucide's `check`, `role="img"`, its accessible name `Yes`) when any `repo` permission of the grant asks that action of the collection, and is empty otherwise |
Sorted is in the order of Unicode code points. A table's cells hold
nothing but what this says.
In those sentences, a list of words is joined as `a`, `a and b`, or `a,
b and c`, and a sentence's first letter is a capital:
- **`<Account clauses>`**: each account attribute once, at the strongest
action asked of it (`manage` over `read`; `transition:email` asks
`email` to read), in the order email, status, repository, joined as a
list: email read `see your email address`, email manage `see and change
your email address`, status read `see whether your account is active`,
status manage `deactivate and reactivate your account`, repository read
`see the state of your data`, repository manage `import your data from
elsewhere`.
- **What is asked of each collection**: every action any `repo:` token
asks of it (`atproto/permission.md`: all three when a token gives
none). A collection other than `*` whose actions `*` has too is not
said again. `<Actions>` are those actions, in the order create, update,
delete, as the verbs `add`, `change` and `remove`, joined as a list.
- **`<app>`**: the collection's NSID's first two segments, reversed, as
the domain its namespace is rooted at: `app.bsky.feed.post` is in
`bsky.app`, `com.example.notes` in `example.com`. (A namespace under a
two-label public suffix, as `uk.co.example`, is named by those two
labels, `co.uk`: the scope alone cannot say better.)
- **`<Data clauses>`**: an app's collections that have the same actions
make one clause, `<Actions> <things>`, in the order the scope first
names them, each a sentence of its own (its first letter a capital, a
full stop after it), the sentences joined with a space. A thing is the
NSID's last segment, its camel case split into lower-case words, its
last word made plural: as it is when it ends in `s`; `ies` in place of
a final `y` after a letter other than `a`, `e`, `i`, `o` and `u`; `es`
after a final `x`, `z`, `ch` or `sh`; else `s` after it (`post` `posts`,
`listItem` `list items`, `notes` `notes`, `reply` `replies`, `day`
`days`, `box` `boxes`), and the things are joined as a list. So
`repo:app.bsky.feed.post?action=create&action=delete
repo:app.bsky.feed.like repo:app.bsky.graph.follow?action=create`
reads `Your data in bsky.app: Add and remove posts. Add, change and
remove likes. Add follows.`
- **`<kinds>`**: by each type the `blob:` tokens accept, once each, in the
order first given, but `files` last: `any file` for `*/*`, which says
all; else `images` for `image/…`, `videos` for `video/…`, `audio` for
`audio/…`, `text` for `text/…`, and `files` for any other type; joined
as a list.
- **`<services>`**: each service the `rpc:` tokens name, once: the
`did:web` services by their hosts, in the order first named
(`api.bsky.app` for `did:web:api.bsky.app#bsky_appview`), then `a
service` once for any other DID, then `any service` for `*`; joined as
a list. Which methods are asked is in `Technical details`.
- **`<Space heading>`**: whose spaces, and of which type, said from the
account's side: a space it does not own it reaches only as the space
lets it, so those are the spaces it is in (`SPACES-POLICIES.md`, "Who
is authorized"). By the space's `spaceType` and `authority`:
| `spaceType` | `authority` `self` | a DID | `*` |
| --- | --- | --- | --- |
| a type | `Your <Name> spaces` | `<Owner>'s <Name> spaces you're in` | `<Name> spaces you're in` |
| `*` | `All your spaces` | `<Owner>'s spaces you're in` | `Every space you're in` |
For an `skey` that is not `*`, ` named “<skey>”` follows the word
`spaces` (or `space`): `Inbox spaces named “self” you're in`.
`<Name>` is the type's declaration's title (`title:lang`'s `en`, or else
its first key that begins `en-`, or else `title`), or else the type's
NSID's last segment, its camel case split into words, its first letter
a capital and the rest lower case (`forumBoard` `Forum board`).
`<Owner>` is `@<handle>` when `spaceHandles` has the DID, or else the
DID, in `<code>`.
- **`<Space clauses>`**: what the space's tokens ask between them, as
clauses in this order, each a sentence of its own as `<Data clauses>`
are, joined with a space:
1. `read everything in them`, when any asks `read`; or else `see what
you've written in them`, when any asks `read_self`;
2. the writes, which are to the account's own records alone
(`SPACES-REPO.md`): each collection a token names, or for a token
that names none, of a `spaceType` that is not `*`, each of its
declaration's `collections`, with each of that token's actions that
is `create`, `update` or `delete`. Collections with the same actions
make one clause, `<Actions> your own <things>`, in the order first
named, the things as `<Data clauses>` name them, whatever app each is
of; `*`'s thing is `records of any kind`, and a collection other
than `*` whose actions `*` has too is not said again;
3. its `manage` operations, as `OAUTH-SCOPES.md` ("What it allows",
"What each method needs") lets them reach only a space the account
owns (`SPACES-POLICIES.md`). For `authority` `self`: `make new ones`
(`create`), `change who's in them` (`update`) and `delete them`
(`delete`), in that order, joined as a list. For `*`: `make new ones`
(`create`); then `change who's in` (`update`) and `delete`
(`delete`), joined as `a` or `a or b`, with ` the ones you made`
after them; the two joined with `, and ` when there are both. For a
DID, nothing: making a space checks the account's own DID, and
changing or deleting one asks that the account be the space's
authority, so a DID's `manage` reaches no space.
A space that asks none of these reads `Asks for nothing this server
grants.` So `space:com.example.workspace` with a declaration titled
`Workspace` of `[com.example.note, com.example.tile]`, and
`space:com.example.workspace?manage=create&manage=update`, read `Your
Workspace spaces: Read everything in them. Add, change and remove your
own notes and tiles. Make new ones and change who's in them.`; and
`space:fyi.opensocial.conversation?authority=*&collection=*&manage=create&manage=update&manage=delete`,
of a declaration titled `Conversation`, reads `Conversation spaces
you're in: Read everything in them. Add, change and remove your own
records of any kind. Make new ones, and change who's in or delete the
ones you made.`
**Seeing it all.** Allow, Deny and Back (or Another account) are always
in view: at 360 by 740 and at 1200 by 900 CSS pixels, whatever the scope,
they are within the window when the view appears, without scrolling,
and the list scrolls behind them. When the list has six rows or fewer,
no set's title is longer than 60 characters (Unicode code points) nor
its detail longer than 140, and `Technical details` and every set's
`Details` are closed, the whole view fits in the window at both sizes,
with nothing to scroll.
What the `consent` and `reject` answers lead to:
| Answer | The page |
| --- | --- |
| `200 {url}` | sends the browser to `url` |
| `400` | alert `This sign-in has ended. Go back to the app and start again.` Every button but `Back` is then disabled. |
| `507` | alert `The server is out of space. Try again later.` |
| anything else, or no answer | alert `Something went wrong. Try again.` |
`reject` from **Sign in** or **Choose an account** is answered and
followed the same way.
## The passkey page
The page a `_passkeyAdd` link opens (`PASSKEYS.md`, "The passkey page")
has two views. It shows the first, **Add a passkey**.
### Add a passkey
| Control | Accessible name | Does |
| --- | --- | --- |
| heading | `Add a passkey` | |
| text, under the heading | `This passkey, named <name>, will sign in to @<handle> on this server.` | |
| primary button | `Add passkey` | `navigator.credentials.create()` with `__passkeyData.options`; then `passkey-register` with `{credential}`, `credential` the browser's credential as its `toJSON()` gives it |
The view shows the account as **Choose an account** shows one, with its
`name`, `@<handle>` and `picture`. `<name>` is `__passkeyData.name`, as
plain text. In a browser without WebAuthn (`window.PublicKeyCredential`),
the view shows the alert `This browser cannot make passkeys.` when it
appears, and `Add passkey` is disabled.
What adding leads to:
| Answer | The page |
| --- | --- |
| the browser makes no credential, as it fails with `InvalidStateError` | alert `This device already has a passkey for @<handle>.`, and no call is sent |
| the browser makes no credential, failing otherwise (cancelled, timed out) | alert `No passkey was made. Try again.`, and no call is sent |
| `200` | shows **Passkey added** |
| `400` `access_denied` | alert `This link has ended. Make a new one with pds passkey add.` `Add passkey` is then disabled. |
| `400`, any other `error` | alert `That passkey was not added. Try again.` |
| `507` | alert `The server is out of space. Try again later.` |
| anything else, or no answer | alert `Something went wrong. Try again.` |
### Passkey added
| Control | Accessible name |
| --- | --- |
| heading | `Passkey added` |
| text, under the heading | `@<handle> can now sign in with this passkey. You can close this page.` |
It has no buttons.
## The error page
| Control | Accessible name |
| --- | --- |
| heading | `Something went wrong` |
Under the heading, the page shows `__errorData.error_description` as a
paragraph, and under that `Error: <error>`, with the code in `<code>`.
It has no buttons.
*Note:* the page has no request to go back to.
## How it is checked
`node compare.mjs --pages` is a run of its own. It drives both servers'
pages in Chromium (Playwright), with the same steps on each side.
**The steps.** Each step is one flow. It starts with a PAR (the same
client and scope on both sides, as `harness/checks/oauth.mjs` draws them),
loads the page in a browser context of its own, or in one kept from an
earlier step, and acts as a person would:
- sign in, remembered or not;
- a wrong password, then the right one;
- the email code, wrong and then right, with the account's email factor
on (`EMAIL.md`);
- continue as a remembered account;
- another account from the list;
- `login_hint` naming a remembered account (consent at once) or another;
- deny on each view;
- back from consent;
- a request already ended, approved on another tab.
Then, on the server alone, its passkey flows, with Chromium's virtual
authenticator (CTAP2, internal, with resident keys and user
verification), on a server whose `PDS_PUBLIC_URL` is
`http://localhost:<port>` (`PASSKEYS.md`, "The relying party"):
- a passkey added through a link, as `_passkeyAdd` makes it: **Add a
passkey**, then **Passkey added**; the link loaded again, the error
page; a second link in the same browser, its `InvalidStateError` alert;
a link ended by a newer one, its `access_denied` alert;
- sign in with the passkey, remembered or not, through **Consent** to
the client's redirect URI, and the code exchanged; with the account's
email factor on, with no **Email code**;
- `login_hint` naming another account than the passkey's: its alert;
- the browser giving no credential (an authenticator that holds none):
its alert, and no `passkey-sign-in` sent;
- the autofill: the page's conditional request, with `__passkeyOptions`
as its options, answered as a person choosing the passkey among the
identifier field's suggestions (the harness hands the request to the
virtual authenticator), remembered or not, through **Consent**, with no
call before `passkey-sign-in`; and `Sign in with a passkey` pressed
while the autofill asks, its asking ended and the button's sign-in
made.
On every flow, the server's and the reference's, the page calls nothing
as it appears: the API calls compared both sides show it.
Each passkey flow is held to the API calls it makes, in order, and to
everything "Held to this page, the server alone" says below.
On the server, the harness finds each control by the accessible names
above. On the reference, it finds them by the reference's own names,
which the harness keeps beside its steps. The reference's first view,
`Welcome`, takes one more click, on `Sign in`.
**Compared, both sides.**
- The API calls each page made, in order: the endpoint, and its body with
DIDs named by the order the accounts were made.
- Whether each call carried `Authorization: Bearer`.
- Where the browser ended up: the client's redirect URI, with `iss`,
`state` (each side's own), and either `code` or `error`. A code is
then exchanged on both sides, and the token answers are compared as
`OAUTH.md` compares them.
**Held to this page, the server alone.**
- The first view each flow shows, found by its heading, and each
control's accessible name in each view it reaches.
- The texts of the alerts, of **Email code**, of the passkey page's views
and of the error page.
- The consent list: its rows, in order, each heading and sentence word
for word, and nothing in `<code>` but a `Permission` row's token, what
a set's tables put there and a space's owner with no handle; each set's
`Details` closed, its summary, its sentence, its tables cell for cell,
with each cell's `rowspan`, and its spaces. For the request's scope,
with the clients and scopes of `harness/checks/oauth.mjs` and more,
each asked for once before any is asked for again, that merge and cover
one another: actions and collections of several `repo:` tokens of more
than one app with and without `repo:*`, camel-cased and plural-ending
names, `blob:` types under and beside `image/*`, `rpc:` services by
`did:web`, by `did:plc` and `*`, every account attribute at both
actions, `transition:generic` over them, and the harness's permission
sets (`OAUTH-PERMISSION-SETS.md`, "How it is checked"): titled and not,
with and without a detail, in English and other languages, with a long
title and detail, with a grant of nothing, and beside
`transition:generic`.
- The consent list for `space:` scopes, and a set granting `space`
permissions, on the server alone, as the reference keeps no `space:`
permission and its token answers would differ: the harness's lexicon
authority publishes two space type declarations, one titled and one
not, and a set granting a `space` permission beside a `repo` one; a
flow for each of a few clients, once a run, signs in on the server's
page and holds its consent view to this page, and goes no further.
Their spaces: a bare type and one with `manage`, merged; another
account's and a DID with no document, each shown as its DID; each type,
with a key, and `*` of each authority; collections of another app, `*`,
and a type `*` asking for writes it has no collection for; and
`read_self` alone. An owner shown by a handle that verifies is not
checked: no handle of the run resolves by DNS or HTTPS
(`OAUTH-SCOPES.md`, "On the authorization page").
- Seeing it all: on each consent view, Allow, Deny and Back (or Another
account) within the window; and with six rows or fewer, no set's title
or detail longer than above, the document's `scrollHeight` no taller
than the window. Every flow's device is 360 by 740 or 1200 by 900.
- `Technical details`, holding each token of the scope, and under each
`include:` the scope strings its set grants.
- Focus when each view appears.
- Busy: one sign-in a run, held back while the harness checks
`aria-busy` and the disabled buttons.
- The page's headers and its HTML as above. Each asset the page loads:
its status, `Content-Type`, `Cache-Control` and `nosniff`. A name the
build does not have, a path with dot segments, and another method:
`404`. After the flows, the server's `pds_requests_total` counts those
under the one route `/oauth/assets/{name}` (`OPERATIONS.md`), its `200`s
and `404`s, with no label holding a name.
- No message in the console: so no violation of the page's
`Content-Security-Policy`, and no error. The browser's own notes of a
request answered with an error status, or not answered, as a wrong
password's and the error page's are, are not the page's, and are let
pass.
- No request to another origin, other than to the client's redirect URI.
- At 360 by 740 CSS pixels, with the dark colour scheme, each view's
`scrollWidth` no wider than the window.
- axe-core's rules (`wcag2a`, `wcag2aa`), run on each view, find nothing.
Not compared: how the pages look, and the reference's texts.
`harness/layers.mjs` and `harness/contrast.mjs` check the app's source
(`web/AGENTS.md`). They run with the code gates.