0002-00000222

Updated at:

Problem description

The request contains an invalid value for AccessKeyId in the x-oss-credential field.

Causes

You sent a request that uses a v4 signature, but the value of AccessKeyId in the x-oss-credential parameter is invalid.

Examples

In the following example, the request URL includes v4 signature information, but the value of AccessKeyId in the x-oss-credential parameter is invalid.

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=\rabc/20221220/cn-hangzhou/oss/aliyun_v4_request&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

The x-oss-credential parameter is required and is used to specify the signature information. The format of the parameter is <AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request. In the preceding example, the value of AccessKeyId is invalid because the value '\rabc' contains an invalid character.

Solutions

A request URL that uses a v4 signature must include four required parameters: x-oss-signature-version, x-oss-credential, x-oss-expires, and x-oss-signature. It can also include one optional parameter: x-oss-additional-headers. The following code provides a valid example:

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************/20221220/cn-hangzhou/oss/aliyun_v4_request&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

References

  • For information about how to use Alibaba Cloud SDKs to initiate a request that uses the V4 signature, see Overview.

  • Calculate the signature:

    If the server returns a response that contains the StringToSign parameter, you must check whether the value of the StringToSign parameter on the server is the same as the string before calculation.