Problem description
The date in X-Amz-Credential does not match the date portion of X-Amz-Date.
Causes
X-Amz-Credential uses the short date format (yyyyMMdd), while X-Amz-Date uses the full ISO 8601 format (yyyyMMddTHHmmssZ). The date portions of both fields must be identical. If they differ, OSS rejects the request.
Examples
The following request fails because X-Amz-Credential contains 20201220 while X-Amz-Date contains 20221220T084818Z — a two-year difference.
GET /test.txt
?X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=LTAI****************/20201220/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: trueSolutions
Use Amazon S3 SDKs to construct and send requests — the SDK handles signature generation automatically and prevents this class of error. See Use Amazon S3 SDKs to access OSS.
If you are constructing requests manually, make sure X-Amz-Credential and X-Amz-Date use the same date, the URL-based request is complete, and all fields of the request are correctly configured. In the corrected request below, both fields use 20221220:
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