|
|
@ -390,8 +390,7 @@ specify parameter values. The flow for this method is as follows:
|
|
|
|
## Client Authentication
|
|
|
|
## Client Authentication
|
|
|
|
|
|
|
|
|
|
|
|
Most API endpoints require the user to identify themselves by presenting
|
|
|
|
Most API endpoints require the user to identify themselves by presenting
|
|
|
|
previously obtained credentials in the form of an `access_token` query
|
|
|
|
previously obtained credentials in the form of an access token.
|
|
|
|
parameter or through an Authorization Header of `Bearer $access_token`.
|
|
|
|
|
|
|
|
An access token is typically obtained via the [Login](#login) or
|
|
|
|
An access token is typically obtained via the [Login](#login) or
|
|
|
|
[Registration](#account-registration-and-management) processes. Access tokens
|
|
|
|
[Registration](#account-registration-and-management) processes. Access tokens
|
|
|
|
can expire; a new access token can be generated by using a refresh token.
|
|
|
|
can expire; a new access token can be generated by using a refresh token.
|
|
|
@ -405,16 +404,19 @@ investigate [macaroons](http://research.google.com/pubs/pub41892.html).
|
|
|
|
|
|
|
|
|
|
|
|
### Using access tokens
|
|
|
|
### Using access tokens
|
|
|
|
|
|
|
|
|
|
|
|
Access tokens may be provided in two ways, both of which the homeserver
|
|
|
|
Access tokens may be provided via a request header, using the Authentication
|
|
|
|
MUST support:
|
|
|
|
Bearer scheme: `Authorization: Bearer TheTokenHere`.
|
|
|
|
|
|
|
|
|
|
|
|
1. Via a query string parameter, `access_token=TheTokenHere`.
|
|
|
|
Clients may alternatively provide the access token via a query string parameter:
|
|
|
|
2. Via a request header, `Authorization: Bearer TheTokenHere`.
|
|
|
|
`access_token=TheTokenHere`. This method is deprecated to prevent the access
|
|
|
|
|
|
|
|
token being leaked in access/HTTP logs and SHOULD NOT be used by clients.
|
|
|
|
|
|
|
|
|
|
|
|
Clients are encouraged to use the `Authorization` header where possible
|
|
|
|
Homeservers MUST support both methods.
|
|
|
|
to prevent the access token being leaked in access/HTTP logs. The query
|
|
|
|
|
|
|
|
string should only be used in cases where the `Authorization` header is
|
|
|
|
{{% boxes/note %}}
|
|
|
|
inaccessible for the client.
|
|
|
|
{{% changed-in v="1.11" %}}
|
|
|
|
|
|
|
|
Sending the access token as a query string parameter is now deprecated.
|
|
|
|
|
|
|
|
{{% /boxes/note %}}
|
|
|
|
|
|
|
|
|
|
|
|
When credentials are required but missing or invalid, the HTTP call will
|
|
|
|
When credentials are required but missing or invalid, the HTTP call will
|
|
|
|
return with a status of 401 and the error code, `M_MISSING_TOKEN` or
|
|
|
|
return with a status of 401 and the error code, `M_MISSING_TOKEN` or
|
|
|
|