0002-00000224

更新时间:
复制 MD 格式

Problem description

The value of the x-oss-credential field in the request is invalid.

Causes

The request uses the V4 signature (OSS4-HMAC-SHA256), but the x-oss-credential field does not follow the required format.

The field must be constructed as:

SegmentDescriptionConstraints
<AccessKeyId>Your Alibaba Cloud AccessKey ID
<SignDate>The signing dateYYYYMMDD format (compact, no hyphens)
<Region>The OSS region codeLowercase, e.g. cn-hangzhou
ossThe service identifierFixed value, always lowercase
aliyun_v4_requestTermination stringFixed value, always lowercase

The five segments are joined with forward slashes (/):

<AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request

Examples

The following request contains an invalid x-oss-credential value. The credential ends with /abc instead of the required termination string /aliyun_v4_request.

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=AK**ID/2022-12-20/cn-hangzhou/oss/abc&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

Solutions

Replace the invalid termination string at the end of x-oss-credential with aliyun_v4_request:

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

If the error persists, check the StringToSign value. When the server returns a response that contains the StringToSign parameter, verify that the StringToSign value on the server matches the string you computed before signing.

References