0002-00000403

更新时间:
复制 MD 格式

Problem description

The Credential field is missing from the Authorization request header in an Amazon S3-compatible Signature Version 4 request.

Causes

The Authorization header in the request does not include the Credential field, which is required for Amazon S3-compatible Signature Version 4 authentication.

Examples

The following request is missing the Credential field in the Authorization header. Only SignedHeaders and Signature are present.

GET /test.txt HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization:AWS4-HMAC-SHA256 SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=34*****
x-amz-content-sha256: abc***
x-amz-date: 20221220T084818Z
x-oss-s3-compat: true

Solutions

Make sure the Authorization header includes all three required fields: Credential, SignedHeaders, and Signature.

The Credential field follows this format:

<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request
ComponentDescriptionExample
<YOUR-AKID>Your AccessKey IDLTAI****************
YYYYMMDDThe date of the request20221220
REGIONThe region where the bucket is locatedus-east-1
SERVICEThe service name for S3-compatible requestss3
aws4_requestThe request terminator (fixed value)aws4_request

The following example shows a correctly constructed Authorization header:

GET /test.txt HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization:AWS4-HMAC-SHA256 Credential=LTAI****************/20221220/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=34****
x-amz-content-sha256: abc****
x-amz-date: 20221220T084818Z
x-oss-s3-compat: true

To avoid constructing the Authorization header manually, use an Amazon S3 SDK. SDKs handle signing automatically. For details, see Use Amazon S3 SDKs to access OSS.