Holler server protocol, version 1
How a reporting app, such as Holler, connects to any server that takes reports, given only the address somebody types in. Published at https://hollerit.app/server.html. Fast Trac (https://trailissues.net) is the reference implementation, and its live documents are good examples: https://trailissues.net/.well-known/holler and https://trailissues.net/.well-known/oauth-authorization-server.
It is three standard pieces put together:
- Discovery: a JSON document at a fixed address on the server.
- Sign-in: OAuth 2 with the authorization code grant and PKCE (RFC 6749, RFC 7636), as native apps use it (RFC 8252), with the app identified by a client ID metadata document, so no app has to be registered with a server first.
- Reports: the holler.report document, posted to the server with a bearer token.
The key words MUST, SHOULD and MAY are used as in RFC 2119.
1. Discovery
The person types a server's address (trailissues.net, or https://trails.example.org). The app adds https:// if it is missing, then fetches:
GET https://<server>/.well-known/holler
Accept: application/json
The server MUST answer with this document:
{
"protocol": "holler.server",
"protocol_version": 1,
"name": "Fast Trac",
"icon": "https://trailissues.net/apple-touch-icon.png",
"report_formats": ["holler.report/1"],
"reports_endpoint": "https://trailissues.net/api/v1/reports",
"authorization_endpoint": "https://trailissues.net/connect",
"token_endpoint": "https://trailissues.net/api/v1/connect/token",
"oauth_metadata": "https://trailissues.net/.well-known/oauth-authorization-server",
"max_photos": 10,
"max_photo_kilobytes": 12288,
"manage_url": "https://trailissues.net/settings/connected-apps"
}
| Field | Required | Meaning |
|---|---|---|
protocol | MUST | Always holler.server. |
protocol_version | MUST | This document describes 1. An app MUST NOT use a server whose version it does not know. |
name | MUST | What to call the server: "Connect to Fast Trac". |
icon | SHOULD | An https image, square, at least 180 px. |
report_formats | MUST | The report documents the server reads, as <format>/<version>. Version 1 servers MUST include holler.report/1. |
reports_endpoint | MUST | Where reports are posted (section 3). |
authorization_endpoint | MUST | Where the person is sent to allow the app (section 2). |
token_endpoint | MUST | Where the app swaps its code for a token (section 2). |
oauth_metadata | MAY | The server's RFC 8414 metadata, for generic OAuth libraries. |
max_photos, max_photo_kilobytes | MAY | Limits on photos sent with one report. |
manage_url | MAY | Where the person can see and disconnect their apps. |
Other fields MAY appear and MUST be ignored by an app that does not know them. Every address in the document MUST be https. The server SHOULD send Access-Control-Allow-Origin: *.
reports_endpoint, authorization_endpoint and token_endpoint MUST be on the same scheme, host and port as the address the person typed. An app MUST refuse a discovery document whose endpoints are anywhere else, and MUST only ever send a token to the reports_endpoint of the server it was issued by. Otherwise a tampered or mistaken document could send people's sign-in, or their tokens, to another host.
An app SHOULD show the server's name and icon before sending the person on, so they know where they are signing in.
2. Sign-in
OAuth 2's authorization code grant with PKCE. The app is a public client: it keeps no secret.
The app describes itself
The app's client_id is an https address it controls, serving a JSON description of the app (a *client ID metadata document*). For Holler, https://hollerit.app/oauth-client.json:
{
"client_id": "https://hollerit.app/oauth-client.json",
"client_name": "Holler",
"logo_uri": "https://hollerit.app/icon.png",
"redirect_uris": ["holler://connected", "https://hollerit.app/connected"]
}
client_idMUST equal the address the document is served from.client_nameMUST be present. The server shows it as the app's name.redirect_urisMUST list every link a code may be sent back to: the app's own URL scheme, or https addresses on the same host asclient_id(universal links).logo_uriMAY be given, https only.
An app SHOULD use an https redirect_uri on its own host that the phone hands only to that app (an iOS universal link, an Android App Link), rather than a custom URL scheme such as holler://. Any app can register a custom scheme, so another app could start a sign-in with Holler's own client_id and its own PKCE pair, receive the code on holler://, and swap it for a token, while the person saw a genuine "Connect Holler?" page. PKCE does not prevent this, since that app made the verifier (RFC 8252, section 8.6). A claimed https link does. Servers MAY accept custom schemes listed in an app's description, and SHOULD prefer to show the person which app is asking as plainly as they can.
The server MUST fetch it over https, without following redirects, and MUST refuse it if client_id does not match, client_name is missing, or the requested redirect_uri is not listed exactly. It SHOULD cache it (Fast Trac: an hour), SHOULD refuse addresses that resolve to private or internal networks, and SHOULD limit its size and the time it waits.
Step 1: the app sends the person to the server
The app makes a random code verifier: 43 to 128 characters from A-Z a-z 0-9 - . _ ~, kept in memory. Its code challenge is BASE64URL(SHA256(verifier)), unpadded. The app also makes a random state.
The app opens the authorization_endpoint in the system's sign-in browser (ASWebAuthenticationSession on iOS, Custom Tabs on Android), never in an embedded web view:
https://trailissues.net/connect
?response_type=code
&client_id=https%3A%2F%2Fhollerit.app%2Foauth-client.json
&redirect_uri=holler%3A%2F%2Fconnected
&state=<state>
&code_challenge=<challenge>
&code_challenge_method=S256
&scope=reports
The server signs the person in however it normally does (password, passkey, two factors, or creating an account where the server allows it), then asks them to allow the app, showing the app's name and logo from its description.
Step 2: the server sends the person back
- Allowed:
holler://connected?code=<code>&state=<state> - Turned down:
holler://connected?error=access_denied&state=<state>
The app MUST check that state is the one it sent.
The code MUST work only once, and SHOULD expire within ten minutes (Fast Trac: five).
When a request cannot be answered safely (an unreadable description, an unlisted redirect_uri, no S256 challenge), the server MUST NOT redirect anywhere. It shows the person an error instead.
Step 3: the app swaps the code for a token
POST <token_endpoint>
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code=<code>
&redirect_uri=holler%3A%2F%2Fconnected
&client_id=https%3A%2F%2Fhollerit.app%2Foauth-client.json
&code_verifier=<verifier>
The server MUST check that the code was issued to this client_id and redirect_uri, and that BASE64URL(SHA256(code_verifier)) equals the challenge. Then:
{ "access_token": "12|abc...", "token_type": "Bearer", "scope": "reports", "user": { "name": "Sam Rivera", "email": "sam@trailcrew.org" } }
user is optional, for the app to show who it is connected as. A server MAY add expires_in; Fast Trac's tokens do not expire until disconnected.
Errors are OAuth's, with status 400: { "error": "invalid_grant" } (bad, used or expired code, or a mismatch), { "error": "unsupported_grant_type" }. The app should start again from step 1.
The app MUST store the token in secure storage (the Keychain on iOS) and send it as Authorization: Bearer <token>.
Disconnecting
A server SHOULD let the person disconnect an app (Fast Trac: Settings > Connected apps, given as manage_url). From then on its token answers 401, and the app should ask the person to connect again.
3. Reports
POST <reports_endpoint>
Authorization: Bearer <token>
Accept: application/json
The body is a holler.report document. The report is filed as the person the token belongs to.
- Without photos:
Content-Type: application/json, the document as the body. - With photos:
multipart/form-data, the document as a string in a field namedreport, and each photo in a field namedphotos[], with the filename the document'sattachmentsgive it. A server MAY ignore an attachment of kindmap.
Retries
A report sent again with the same document id (or the same Idempotency-Key header, if the app sends one) by the same person within a day MUST NOT file a second report. The server answers 200 with the report already filed. An app should keep a report's id the same on every retry, and retry on a network error or a 5xx answer.
Answers
201 Created (or 200 for a retry):
{
"data": {
"id": 1227,
"url": "https://trailissues.net/reports?scope=mine&viewing=1227",
"status": "open",
"trail": { "id": 450, "name": "Highway to Heaven" },
"location": "At the junction with Cry Baby"
}
}
| Field | Required | Meaning |
|---|---|---|
id | MUST | The server's number for the report, to quote back to the person. |
url | SHOULD | Where the person can see it. |
status | MAY | Where it stands, in the server's words. |
trail, location | MAY | What the server made of where it is, or null. |
| Status | Meaning | What the app does |
|---|---|---|
401 | No token, or disconnected | Ask the person to connect again. |
413 | Too large | Send fewer or smaller photos. |
422 | Not a document the server reads | Do not retry as is. The body says why. |
429 | Too many requests | Wait for the Retry-After seconds. |
5xx | The server failed | Retry later with the same id. |
4. Without sign-in
A server that cannot do section 2 can still take reports: the person makes a token on the server and pastes it, with the server's address, into the app, which then uses section 3. Fast Trac offers this on Settings > Connected apps.
Versioning
New optional fields may appear within a version. A change an existing app or server would misread raises protocol_version.
PKCE test vector
To check a server computes challenges correctly:
- code verifier:
holler-test-verifier-0123456789-abcdefghijklmnopqrstuv - S256 code challenge:
HT3t7-e4e2_bJOd2gfreCGsGWXv5GT6fmUfr3lsjTng
The challenge is BASE64URL(SHA256(ASCII(verifier))) with the = padding removed and + / replaced by - _.
The Holler app's own description
Holler's client ID metadata document is live at https://hollerit.app/oauth-client.json:
{
"client_id": "https://hollerit.app/oauth-client.json",
"client_name": "Holler",
"client_uri": "https://hollerit.app",
"logo_uri": "https://hollerit.app/img/holler-icon.png",
"redirect_uris": ["holler://connected"]
}
A server that follows this protocol needs nothing else from Holler: no registration, no shared secret.