0002-00000212

更新时间:
复制 MD 格式

Issue description

The signature date in the Authorization header is invalid.

Cause

The request uses the V4 signature, but the signature date in the Credential field of the Authorization header is invalid.

Example

Sample request:

GET /oss.jpg HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT
Authorization: OSS4-HMAC-SHA256 Credential=AK**ID/2022-12-20/cn-hangzhou/oss/aliyun_v4_request,Signature=18**0a
x-oss-content-sha256: UNSIGNED-PAYLOAD

The format of the Credential field is <AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request. In the format:

  • <AccessKeyId>: the AccessKey ID used to sign the request.

  • <SignDate>: the signature date in the YYYYMMDD format. For example, 20221220 for December 20, 2022.

  • <Region>: the region in which the request accesses OSS resources.

In this example, <SignDate> is set to 2022-12-20, which is invalid.

Solution

Change <SignDate> to the YYYYMMDD format. In this example, use 20221220.

References

  • For information about how to use Alibaba Cloud SDKs to initiate a request that uses the V4 signature, see Overview.

  • Calculate the signature:

    If the server returns a response that contains the StringToSign parameter, you must check whether the value of the StringToSign parameter on the server is the same as the string before calculation.