Problem description
The AccessKeyId field in the Authorization header is blank.
Causes
The request uses the V2 signature, but the AccessKeyId field in the Authorization header has no value.
Examples
The following request uses the V2 signature with an invalid 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: OSS2 AccessKeyId:,AdditionalHeaders:host,Signature:n7I**I0=Note the :, sequence: the value between the colon and the comma is blank.
The Authorization header for V2 signature requests uses this structure:
OSS2 <signature-information>The signature version (OSS2) and signature information are separated by a space. Only OSS2 is supported as the signature version. Signature information is a comma-separated list of key:value pairs:
| Field | Required | Description |
|---|---|---|
AccessKeyId | Yes | Your Alibaba Cloud AccessKey ID |
Signature | Yes | The computed signature string |
AdditionalHeaders | No | Additional headers included in the signature |
In the invalid example above, AccessKeyId is used as a key but has no value.
Solutions
Set AccessKeyId to your Alibaba Cloud AccessKey ID. The following request shows the correct format:
GET /oss.jpg HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2022 08:48:18 GMT
Authorization: OSS2 AccessKeyId:44**07,AdditionalHeaders:host,Signature:n7I**I0=If the server returns a StringToSign parameter in the error response, compare that value with the string you constructed before signing. A mismatch indicates an error in how you built the string to sign.References
To sign V2 requests automatically using Alibaba Cloud SDKs, see Use Alibaba Cloud SDKs for V2 signature.
To calculate the V2 signature manually, see the OSS SDK for Python auth.py source.
To understand the full V2 signing algorithm, see V2 signature overview.