Help Center/ Optical Character Recognition/ FAQs/ Token-based Authentication/ Why Is the Error Message "The username or password is wrong." Displayed?
Updated on 2024-05-11 GMT+08:00

Why Is the Error Message "The username or password is wrong." Displayed?

Symptom

"The username or password is wrong." is displayed when you obtain the token.

Check whether your Huawei Cloud account has been upgraded to a Huawei ID. If you log in to your Huawei Cloud account through the Huawei ID entry, you will be prompted to upgrade your account.

If your Huawei Cloud account has been upgraded to a Huawei ID, you cannot obtain an account token. Create an IAM user and use it to obtain a token.

Step 1: Create an IAM User

  1. Log in to the Huawei Cloud management console, hover your cursor over the username in the upper right corner of the page, and choose Identity and Access Management from the drop-down list.
    Figure 1 Selecting Identity and Access Management
  2. On the Users page, click Create User. On the displayed page, set the username and password to create an IAM user.
    Figure 2 Create User
    Figure 3 Setting the username and password
  3. Grant the admin permission to the IAM user.
    Figure 4 Joining a user group

Step 2: Use the IAM User to Obtain a Token

The following uses obtaining a token in the AP-Bangkok (ap-southeast-2) region as an example.

You can log in to the console and choose My Credentials > API Credentials to obtain the values of username, domainname, and project name. password indicates the user password.

Figure 5 API Credentials
POST https://iam.ap-southeast-2.myhuaweicloud.com/v3/auth/tokens //Uses obtaining the token in the AP-Bangkok region as an example.
Request Header:
Content-Type: application/json

Request Body:
{ 
    "auth": { 
        "identity": { 
            "methods": [ 
                "password" 
            ], 
            "password": { 
                "user": { 
                    "name": "username", //IAM username
                    "password": "********", //IAM user password
                    "domain": { 
                        "name": "domainname" //Master account name
                    } 
                } 
            } 
        }, 
        "scope": { 
            "project": { 
                "name": "project name" //Region name, for example, ap-southeast-2
            } 
        } 
    } 
}