Problem description
The Authorization request header contains invalid signature information.
Causes
The request uses the V4 signature, but the Authorization header is malformed.
Examples
The following request fails because it includes an unknown key (UnknownKey=1) in the signature information:
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 CredentialAK**ID/20221220/us-east-1/oss/aliyun_v4_request,Signature=18**0a,UnknownKey=1
^^^^^^^^^^^^^ invalid: unknown key
x-oss-content-sha256: UNSIGNED-PAYLOADThe Authorization header for a V4 signature request has the following structure:
Authorization: <SignatureVersion> <SignatureInfo><SignatureVersion>and<SignatureInfo>are separated by a space.<SignatureInfo>is a comma-separated list of key-value pairs, where each key and value are connected by an equal sign (=).
The valid signature information fields are:
| Field | Required | Description |
|---|---|---|
Credential | Yes | Your access key ID and the signing scope, in the format <AccessKeyID>/<Date>/<Region>/oss/aliyun_v4_request |
AdditionalHeaders | No | Additional headers included in the signature |
Signature | Yes | The computed HMAC-SHA256 signature |
Only OSS4-HMAC-SHA256 is supported as the signature version. Any key not listed in the table above is invalid.
Solutions
Fix the Authorization header to include only the required fields (Credential and Signature) and the optional field (AdditionalHeaders). 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-PAYLOADVerify the fix: If the server returns a response containing the StringToSign parameter, check that the StringToSign value on the server matches the string you computed before signing.
References
To use an Alibaba Cloud SDK to send V4 signature requests, see Overview.
To calculate the V4 signature manually, see Calculate V4 signature by using OSS SDK for Python.
For the V1 signature specification, see Overview.