Help Center/ API Request Signing Guide/ Developer Guide/ FAQs/ How Do I Use a Temporary AK/SK to Sign Requests?
Updated on 2023-09-11 GMT+08:00

How Do I Use a Temporary AK/SK to Sign Requests?

Integrate the signing SDK into your application and add the following parameter and value to the message header:

X-Security-Token:{securityToken}

Then, use a temporary AK/SK to sign the request. The signing SDK can be the SDK used for AK/SK-based authentication.

  1. Create an API, set the authentication mode to IAM, and publish the API.
  2. Obtain a temporary AK/SK and {securityToken}. For details, see the IAM API Reference.

    A response similar to the following is displayed:
    {
        "credential": {
            "access": "P0HEQUQ4XBWXY5WD69X0",
            "expires_at": "2022-10-17T18:51:25.231000Z",
            "secret": "3WJu****hDVs",
            "securitytoken": "XXXXXX......"
        }
    }

  3. Construct a request with signature parameters.

    ...
    request.setKey("P0HE****69X0");
    request.setSecret("3WJu****hDVs");
    request.setMethod("GET");
    request.setUrl("url");
    request.addHeader("X-Security-Token", "XXXXXX......");
    ...