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: trueSolutions
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| Component | Description | Example |
|---|---|---|
<YOUR-AKID> | Your AccessKey ID | LTAI**************** |
YYYYMMDD | The date of the request | 20221220 |
REGION | The region where the bucket is located | us-east-1 |
SERVICE | The service name for S3-compatible requests | s3 |
aws4_request | The 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: trueTo 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.