0002-00000409

Updated at: 2025-04-01 15:53

Issue description

The time provided in the Credential field of the Authorization header does not match the time specified by the Date parameter in the header.

Cause

You initialize a request that uses the Amazon S3-compatible V4 signature. However, the time provided in the Credential field of the Authorization header does not match the time specified by the Date parameter in the header.

Example

The following code provides an example:

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****************/20130524/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=1
x-amz-content-sha256: abc***
x-amz-date: 20221220T084818Z
x-oss-s3-compat: true

In the preceding example, the time 20130524 provided in the Credential field of the Authorization header does not match the time 20221220T084818Z that is specified by the Date parameter in the header.

Solution

Make sure that the Authorization header is complete and that the time provided by the Credential field of the header is the same as the time specified by the Date parameter of the header. The following code provides a correct example:

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

We recommend that you use Amazon S3 SDKs to initiate the request. For more information, see Use Amazon S3 SDKs to access OSS.

  • On this page (1, T)
  • Issue description
  • Cause
  • Example
  • Solution
Feedback