All Products
Search
Document Center

Object Storage Service:0002-00000205

Last Updated:Jul 21, 2023

Problem description

The Credential field in the Authorization header is missing.

Causes

You initiate a request that uses the V4 signature. However, the Credential field in the Authorization header is missing.

Examples

The following code provides an example. In the example, the format of the Authorization is invalid.

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 Signature=18**0a
x-oss-content-sha256: UNSIGNED-PAYLOAD

The Authorization header uses a space to separate the signature version and signature information.

  • Signature version: Only OSS4-HMAC-SHA256 is supported.

  • Signature information: The signature information is displayed in the form of key-value pairs. Separate key-value pairs with commas (,) and connect keys and values with equal signs (=).

    The key of the signature information includes two required fields (Credential and Signature) and one optional field (AdditionalHeaders). In the preceding example, the required field Credential is missing.

Solutions

Make sure that the format of the Authorization header in the request that uses the V4 signature meets the preceding requirements. Example:

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/20221220/us-east-1/oss/aliyun_v4_request,AdditionalHeaders=host,Signature=18**0a
x-oss-content-sha256: UNSIGNED-PAYLOAD

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.