Tip: To avoid constructing the Authorization header manually, use an Alibaba Cloud SDK, which handles V4 signature calculation automatically. See Overview.Problem description
The Signature field is missing from the Authorization header in a V4 signature request.
Causes
The Authorization header for a V4 signature request must contain two required fields — Credential and Signature — plus the optional AdditionalHeaders field. The Signature field is absent.
The Authorization header has the following format:
{signature-version} {signature-information}| Component | Value |
|---|---|
| Signature version | OSS4-HMAC-SHA256 (only supported value) |
| Signature information | Key-value pairs separated by commas (,), keys and values connected by equal signs (=) |
| Field | Required |
|---|---|
Credential | Required |
Signature | Required |
AdditionalHeaders | Optional |
Examples
The following request triggers this error because the Signature field is missing:
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
^^^^^^^^^^^^^^^^ signature version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Credential only — Signature field missing
x-oss-content-sha256: UNSIGNED-PAYLOADSolutions
Add the Signature field (and, if applicable, AdditionalHeaders) to the Authorization header:
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
^^^^^^^^^^^^^^^^ signature version ^^^^^^^^^^^^^^^^^^^^ optional ^^^^^^^^^^^^^^ required
x-oss-content-sha256: UNSIGNED-PAYLOADIf the server returns a StringToSign parameter in the response, verify that your locally computed StringToSign matches the server's value before recalculating the signature.
References
SDK (recommended): Overview — Alibaba Cloud SDKs for V4 signature
Calculate V4 signature: OSS SDK for Python —
oss2/auth.py#L496V1 signature reference: Overview