summaryrefslogtreecommitdiff
path: root/docs/api/authentication.md
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-06-11 12:39:28 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-06-11 12:39:28 -0400
commit6e6b068ae2adc8c5ef8acb633dcadfbdc3221b61 (patch)
tree79831028416b0d6934f32961a3fc77d8b004369e /docs/api/authentication.md
parent1f009e06fd6db82a91536eec88ef3232267385bf (diff)
tools/reformat
Diffstat (limited to 'docs/api/authentication.md')
-rw-r--r--docs/api/authentication.md18
1 files changed, 7 insertions, 11 deletions
diff --git a/docs/api/authentication.md b/docs/api/authentication.md
index 7b5ebd7..2e9b58f 100644
--- a/docs/api/authentication.md
+++ b/docs/api/authentication.md
@@ -15,10 +15,10 @@ Authentication associates each authenticated request with a user.
To create users, see [initial setup](./initial-setup.md) and [invitations](./invitations.md).
-
## Names
<!-- This prose is duplicated in channels-messages.md. If you change it here, consider changing it there, too. -->
+
The service handles user names using two separate forms.
The first form is as given in the request used to create the user. This form of the use name is used throughout the API, and the service will preserve the name as entered (other than applying normalization), so that users' preferences around capitalization and accent marks are preserved.
@@ -27,8 +27,8 @@ The second form is a "canonical" form, used internally by the service to control
The canonical form is not available to API clients, but its use has practical consequences:
-* Names that differ only by case or only by code point sequence are treated as the same name. If the name is in use, changing the capitalization or changing the sequence of combining marks will not allow the creation of a second "identical" user.
-* The login API accepts any name that canonicalizes to the form stored in the database, making user names effectively case-insensitive and composition-insensitive.
+- Names that differ only by case or only by code point sequence are treated as the same name. If the name is in use, changing the capitalization or changing the sequence of combining marks will not allow the creation of a second "identical" user.
+- The login API accepts any name that canonicalizes to the form stored in the database, making user names effectively case-insensitive and composition-insensitive.
## Identity tokens
@@ -40,13 +40,11 @@ Tokens are issued by logging into the service, using the `/api/auth/login` endpo
To authenticate a request, include
`cookie: identity=TOKEN SECRET` header in the request. For browser-based clients, this may happen automatically.
-
## Authentication failures
Unless the endpoint's documentation says otherwise, all endpoints require authentication. Making a request to any endpoint that requires authentication, either without a token, or with a token that is not valid or that has expired, causes the service to return a
`401 Unauthorized` response, instead of the responses documented for the endpoint the request was intended for. The API will not take action on requests that fail authentication in this way.
-
## `POST /api/auth/login`
Authenticates the user using their name and password. The user must exist before calling this endpoint.
@@ -65,7 +63,7 @@ Authenticates the user using their name and password. The user must exist before
The request must have the following fields:
| Field | Type | Description |
-|:-----------|:-------|:-------------------------------------|
+| :--------- | :----- | :----------------------------------- |
| `name` | string | The login's name. |
| `password` | string | The login's password, in plain text. |
@@ -86,7 +84,7 @@ This endpoint will respond with a status of
The response will include the following fields:
| Field | Type | Description |
-|:-------|:-------|:-------------------------------|
+| :----- | :----- | :----------------------------- |
| `id` | string | The authenticated user's ID. |
| `name` | string | The authenticated user's name. |
@@ -100,7 +98,6 @@ The cookie will expire if it is not used regularly.
This endpoint will respond with a status of
`401 Unauthorized` if the login name and password do not correspond to an existing user.
-
## `POST /api/auth/logout`
Invalidates the identity token used to make the request, logging the caller out.
@@ -120,7 +117,6 @@ This endpoint will respond with a status of `204 No Content` when successful.
The response will include a `Set-Cookie` header that clears the
`identity` cookie. Regardless of whether the client clears the cookie, the service also invalidates the token.
-
## `POST /api/password`
Changes the current user's password, and invalidates all outstanding identity tokens.
@@ -137,7 +133,7 @@ Changes the current user's password, and invalidates all outstanding identity to
The request must have the following fields:
| Field | Type | Description |
-|:-----------|:-------|:-----------------------------------------------|
+| :--------- | :----- | :--------------------------------------------- |
| `password` | string | The login's _current_ password, in plain text. |
| `to` | string | The login's _new_ password, in plain text. |
@@ -156,7 +152,7 @@ This endpoint will respond with a status of
The response will include the following fields:
| Field | Type | Description |
-|:-------|:-------|:-------------------------------|
+| :----- | :----- | :----------------------------- |
| `id` | string | The authenticated user's ID. |
| `name` | string | The authenticated user's name. |