授权用户请求

用户授权请求

Redis 企业软件
方法 路径 描述
发布 /v1/users/authorize 授权用户

授权用户

POST /v1/users/authorize

为用户生成 JSON Web 令牌 (JWT),以用作访问 REST API 的授权。

请求

HTTP 请求示例

POST /v1/users/authorize

示例 JSON 正文

{
    "username": "user@redislabs.com",
    "password": "my_password"
}

Request headers

Key Value Description
Host cnm.cluster.fqdn Domain name
Accept application/json Accepted media type

Request body

Include a JWT authorize object with a valid username and password in the request body.

Response

Returns a JSON object that contains the generated access token.

Example JSON body

{
    "access_token": "eyJ5bGciOiKIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXViOjE0NjU0NzU0ODYsInVpZFI1IjEiLCJleHAiOjE0NjU0Nz30OTZ9.2xYXumd1rDoE0edFzcLElMOHsshaqQk2HUNgdsUKxMU"
}

Error codes

When errors are reported, the server may return a JSON object with error_code and message fields that provide additional information. The following are possible error_code values:

Code Description
password_expired The password has expired and must be changed.

Status codes

Code Description
200 OK The user is authorized.
400 Bad Request The request could not be understood by the server due to malformed syntax.
401 Unauthorized The user is unauthorized.