All Products
Search
Document Center

Object Storage Service:0002-00000223

Last Updated:Mar 28, 2025

Issue description

The signature date specified in the x-oss-credential header in the request is invalid.

Causes

You initiated a request that used a V4 signature, but the signature date specified in the x-oss-credential header is invalid.

Examples

The URL of a request contains information about the V4 signature, but the signature date specified in the x-oss-credential header is invalid.

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************/2022-12-20/cn-hangzhou/oss/aliyun_v4_request&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

The x-oss-credential header in the request parameters is required to specify the signature. The x-oss-credential header is in the following format: <AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request. In the preceding example, the value of the <SignDate> parameter is 2022-12-20. The format of the value is invalid.

Solutions

Change the value of the <SignDate> parameter in the preceding example to 20221220. The following sample code provides an example on how to specify the <SignDate> parameter:

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************/20221220/cn-hangzhou/oss/aliyun_v4_request&x-oss-expires=1141889120&x-oss-additional-headers=host&x-oss-signature=8u**a3 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT

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.