Skip to content

Commit e1f4bfe

Browse files
committed
Updated outdated /users/authorize REST API reference
1 parent 1b08d99 commit e1f4bfe

File tree

1 file changed

+18
-17
lines changed
  • content/operate/rs/references/rest-api/requests/users

1 file changed

+18
-17
lines changed

content/operate/rs/references/rest-api/requests/users/authorize.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ weight: $weight
1313

1414
| Method | Path | Description |
1515
|--------|------|-------------|
16-
| [POST](#post-authorize) | `/v1/users/authorize` | Authorize a user |
16+
| [POST](#post-authorize) | `/v1/users/authorize` | Generate a token to authorize an authenticated user |
1717

1818
## Authorize user {#post-authorize}
1919

2020
POST /v1/users/authorize
2121

22-
Generate a JSON Web Token (JWT) for a user to use as authorization to access the REST API.
22+
Generates a JSON Web Token (JWT) for a user to use as authorization to access the REST API. The request authentication header must include the relevant username and password.
2323

2424
### Request {#post-request}
2525

@@ -29,12 +29,13 @@ Generate a JSON Web Token (JWT) for a user to use as authorization to access the
2929

3030
#### Example JSON body
3131

32-
```json
33-
{
34-
"username": "[email protected]",
35-
"password": "my_password"
36-
}
37-
```
32+
The request body is optional unless you want to specify the token's time to live:
33+
34+
```json
35+
{
36+
"ttl": <time_in_seconds>
37+
}
38+
```
3839

3940
#### Request headers
4041
| Key | Value | Description |
@@ -44,19 +45,19 @@ Generate a JSON Web Token (JWT) for a user to use as authorization to access the
4445

4546
#### Request body
4647

47-
Include a [JWT authorize object]({{< relref "/operate/rs/references/rest-api/objects/jwt_authorize" >}}) with a valid username and password in the request body.
48+
Optionally include a JSON object in the request body to specify the time to live (`ttl`), which determines the amount of time in seconds the token will be valid.
4849

4950
### Response {#post-response}
5051

5152
Returns a JSON object that contains the generated access token.
5253

5354
#### Example JSON body
5455

55-
```json
56-
{
57-
"access_token": "eyJ5bGciOiKIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXViOjE0NjU0NzU0ODYsInVpZFI1IjEiLCJleHAiOjE0NjU0Nz30OTZ9.2xYXumd1rDoE0edFzcLElMOHsshaqQk2HUNgdsUKxMU"
58-
}
59-
```
56+
```json
57+
{
58+
"access_token": "eyJ5bGciOiKIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXViOjE0NjU0..."
59+
}
60+
```
6061

6162
### Error codes {#post-error-codes}
6263

@@ -72,6 +73,6 @@ The following are possible `error_code` values:
7273

7374
| Code | Description |
7475
|------|-------------|
75-
| [200 OK](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1) | The user is authorized. |
76-
| [400 Bad Request](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1) | The request could not be understood by the server due to malformed syntax. |
77-
| [401 Unauthorized](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2) | The user is unauthorized. |
76+
| [200 OK](https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok) | The user is authorized. |
77+
| [400 Bad Request](https://www.rfc-editor.org/rfc/rfc9110.html#name-400-bad-request) | The request could not be understood by the server due to malformed syntax. |
78+
| [401 Unauthorized](https://www.rfc-editor.org/rfc/rfc9110.html#name-401-unauthorized) | The user is unauthorized. |

0 commit comments

Comments
 (0)