0002-00000217

更新时间:
复制 MD 格式

Problem description

The x-oss-credential field is missing from the request.

Causes

The request uses a V4 signature, but the x-oss-credential field is absent from the query string.

Examples

The following request uses a V4 presigned URL but is missing x-oss-credential:

GET /oss.jpg?x-oss-signature-verion=OSS4-HMAC-SHA256&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 field is required. Its value must use the following format: <AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request.

Solutions

Include all required query parameters in the presigned URL. The following table lists the required and optional parameters for a V4 presigned request:

ParameterRequiredDescriptionExample value
x-oss-signature-verionYesSignature algorithm identifierOSS4-HMAC-SHA256
x-oss-credentialYesCredential scope: access key ID, signing date, region, service, and request type<AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request
x-oss-expiresYesURL validity period1141889120
x-oss-signatureYesComputed request signature
x-oss-additional-headersNoAdditional headers included in the signature calculationhost

The value of x-oss-credential uses the following format:

<AccessKeyId>/<SignDate>/<Region>/oss/aliyun_v4_request

For example: LTAI****************/20221220/cn-hangzhou/oss/aliyun_v4_request

The following example shows a corrected request with all required parameters:

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

If the server returns a response containing the StringToSign parameter, verify that its value matches the string you used before computing the signature.

References