Updated on 2023-09-27 GMT+08:00

Authentication Before Sign-In

Before using the CEC in your system, the authentication and verification are performed by using the AK/SK-based authentication API (tokenByAkSk).

  1. Invoke the API Fabric verification API tokenByAkSk of the CEC to perform authentication and obtain an access token.

    1. Use an API test tool to send a request to obtain the token returned by the CEC.
    2. Obtain the URL in the following format and select the POST mode.

      HTTPS method: POST

      URL: https://Domain address/apigovernance/api/oauth/tokenByAkSk
      • Replace Domain address with the actual address or domain name of the CEC.

        For example, in the Huawei Cloud production environment, replace Domain address with service.besclouds.com. In this case, the URL is https://service.besclouds.com/apigovernance/api/oauth/tokenByAkSk.

      • HTTP is an insecure protocol, which may bring risks to the system. Therefore, it is not recommended. HTTPS is recommended.
    3. Enter the values of app_key and app_secret to the body based on the format of the API calling example to obtain the value of AccessToken, as shown in Figure 1. You can learn about requirements on request and response parameter attributes by referring to Table 1 and Table 2.
    Figure 1 Invoking AccessToken
    Table 1 Request body description

    Parameter

    Type

    Position

    Mandatory or Not

    Description

    app_key

    String

    Body

    Yes

    App key corresponding to the app created in the API Fabric (CEC API management center).

    After a tenant space is provisioned, the CEC operations administrator will send the key value at the same time. Keep the key value properly.

    app_secret

    String

    Body

    Yes

    App secret value corresponding to the app created in the API Fabric.

    After a tenant space is provisioned, the CEC operations administrator will send the secret value at the same time. Keep the secret value properly.

    • Example
    {
    "app_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "app_secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }

    Table 2 ResponseBody description

    Parameter

    Type

    Position

    Mandatory or Not

    Description

    AccessToken

    String

    Body

    Yes

    Obtain the output parameter token based on the app key and app secret created in the API Fabric. The token is used to invoke synchronization information.

    ApplyType

    String

    Body

    Yes

    Token type. Currently, only Bearer is supported.

    CreateTime

    String

    Body

    Yes

    Token creation time.

    Expires

    String

    Body

    Yes

    Token expiration time.

    Scope

    String

    Body

    Yes

    Scope of APIs that can be accessed using the token.

    AppKey

    String

    Body

    Yes

    App key.

    UserID

    String

    Body

    Yes

    User ID.

    • Example
    {
    "AccessToken": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "ApplyType": "Bearer",
    "CreateTime": "1543395801",
    "Expires": "600",
    "Scope": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "AppKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "UserID": "sysAdmin"
    }