Skip to content

Commit

Permalink
Add doc section for auth media (#70)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Morgan <[email protected]>
  • Loading branch information
devonh and anoadragon453 authored Dec 12, 2024
1 parent 64a0f3b commit 553517c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,26 @@ Example (generated using the body and public key from the previous examples):
}
}
```

## Authenticated Media

When accessing media from a Synapse homeserver with authenticated media enabled, an
`Authorization` HTTP header must be passed along with any request to the Matrix Content Scanner.
If the `Authorization` header is not present, the content scanner assumes the request is not an
authenticated media request and will use the old Matrix endpoints.

This header follows the `Authentication Bearer scheme` as [outlined in the Matrix specification](https://spec.matrix.org/v1.12/client-server-api/#using-access-tokens).
The `access_token` must be the Matrix access token of the client's user.
The `Authorization` header method must be used, sending the access token as a query string
parameter is not supported.

Example authorization header:

```
Authorization: Bearer <access_token>
```

If a request is made for authenticated media and the access token is invalid, the content scanner
will respond with HTTP status 502, errcode `MCS_MEDIA_REQUEST_FAILED`.
If a request is made for authenticated media and the `Authorization` header is missing, the content
scanner will respond with HTTP status 404, errcode `M_NOT_FOUND`.

0 comments on commit 553517c

Please sign in to comment.