Problem description
The request is missing the x-oss-expires parameter, which is required for all V4 presigned URL requests.
Causes
The request uses V4 signature authentication (OSS4-HMAC-SHA256) but does not include x-oss-expires. This parameter specifies when the signature expires and is mandatory.
Examples
The following request triggers this error. The x-oss-expires parameter is absent from the query string:
GET /oss.jpg
?x-oss-signature-verion=OSS4-HMAC-SHA256
&x-oss-credential=***
&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 GMTSolutions
Add all required V4 signature parameters to the query string. The following table lists each parameter, whether it is required, and its expected value:
| Parameter | Required | Description |
|---|---|---|
x-oss-signature-verion | Required | Signature algorithm identifier. Set to OSS4-HMAC-SHA256. |
x-oss-credential | Required | Credential string in the format <AccessKeyID>/<date>/<region>/oss/aliyun_v4_request. |
x-oss-expires | Required | Signature expiration time as a UNIX timestamp (seconds since epoch). OSS rejects requests received after this time. |
x-oss-signature | Required | The computed signature value. |
x-oss-additional-headers | Optional | Semicolon-separated list of additional signed headers, such as host. |
A correctly formed request looks like this:
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 GMTIf the server returns a StringToSign value in the response, verify that it matches the string you signed before computing x-oss-signature.
References
For information about how to use Alibaba Cloud SDKs to send requests that use the V4 signature, see Overview.
For information about how to calculate the V4 signature, see Calculate V4 signature by using OSS SDK for Python.
For information about the V1 signature approach, see Overview.