0002-00000425

更新时间:
复制 MD 格式

Problem description

The value of the X-Amz-Credential field in the request is invalid.

Causes

The request uses an Amazon S3-compatible Signature Version 4 (SigV4), but the value of X-Amz-Credential does not match the required format.

X-Amz-Credential must follow this format:

<AccessKey-ID>/YYYYMMDD/REGION/SERVICE/aws4_request
SegmentDescriptionExample
<AccessKey-ID>Your Alibaba Cloud AccessKey IDLTAI****************
YYYYMMDDThe date of the request in UTC, formatted as YYYYMMDD20221220
REGIONThe region identifier, must be all lowercaseus-east-1
SERVICEThe service identifier, must be all lowercases3
aws4_requestFixed termination string, must be all lowercaseaws4_request

Examples

The following request fails because the X-Amz-Credential value is invalid:

GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=ab2***st HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: true

Solutions

Set X-Amz-Credential to a valid value, then verify that all other signature fields are present and correct.

Valid credential example:

X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request

The following request includes a correctly formatted X-Amz-Credential:

GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=ab2s**** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: true

To avoid constructing SigV4 requests manually, use Amazon S3 SDKs to access OSS. For more information, see Use Amazon S3 SDKs to access OSS.