0002-00000064

更新时间:
复制 MD 格式

Problem description

The AccessKeyId value in the Authorization header is invalid.

Causes

The AccessKeyId field in the Authorization header has an invalid value. A common example is a tab character (\t) included in the value.

Examples

The following request triggers this error because the AccessKeyId value contains \t:

GET /test.txt HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Authorization: OSS  qn6qrrqxo2\t:UNQDb7GapEgJkcde6OhZ9J*****

Solutions

Construct the Authorization header using the following format:

Authorization = "OSS " + AccessKeyId + ":" + Signature

Where Signature is:

Signature = base64(hmac-sha1(AccessKeySecret,
            VERB + "\n"
            + Content-MD5 + "\n"
            + Content-Type + "\n"
            + Date + "\n"
            + CanonicalizedOSSHeaders
            + CanonicalizedResource))
ComponentDescription
OSS Literal prefix — note the trailing space
AccessKeyIdYour access key ID — must contain only valid characters, with no whitespace or control characters
Signaturebase64-encoded HMAC-SHA1 of the signing string

Make sure the AccessKeyId value contains no illegal characters before constructing the header. For the full signing procedure, see Include signatures in the Authorization header.

Tip: Use Alibaba Cloud SDKs to generate signatures automatically. SDKs handle the signing process for you, eliminating this class of error. See Overview.