Updated on 2023-07-05 GMT+08:00

Changing the Login Password

Function

This API can be used by an IAM user to change the login password.

The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.

URI

POST /v3/users/{user_id}/password

Table 1 URI parameters

Parameter

Mandatory

Type

Description

user_id

Yes

String

IAM user ID. For details about how to obtain a user ID, see Obtaining Account, IAM User, Group, Project, Region, and Agency Information.

Request Parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Fill application/json;charset=utf8 in this field.

X-Auth-Token

Yes

String

Token (no special permission requirements) of the IAM user corresponding to the user_id specified in the URL.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

user

Yes

Object

IAM user information.

Table 4 user

Parameter

Mandatory

Type

Description

password

Yes

String

New password, which must meet the following requirements:

  • Can contain 6 to 32 characters. The default minimum password length is 6 characters.
  • Must contain at least two of the following character types: uppercase letters, lowercase letters, digits, and special characters.
  • Cannot contain the user's mobile phone number or email address.
  • Must meet the password requirements defined in the account's password policy.
  • Must be different from the old password.

original_password

Yes

String

Old password of the IAM user.

Response Parameters

None

Example Request

Request for changing the login password from IAMOriginalPassword@ to IAMNewPassword@ as an IAM user

POST https://iam.myhuaweicloud.com/v3/users/{user_id}/password
{
    "user": {
        "password": "IAMNewPassword@",
        "original_password": "IAMOriginalPassword@"
    }
}

Example Response

None

Status Codes

Status Code

Description

204

The password is changed successfully.

400

Invalid parameters.

401

Authentication failed.

403

Access denied.

404

The requested resource cannot be found.

405

The method specified in the request is not allowed for the requested resource.

413

The request entity is too large.

500

Internal server error.

503

Service unavailable.

Error Codes

None