All Products
Search
Document Center

Object Storage Service:0002-00000425

Last Updated:Apr 01, 2025

Problem description

The value of the X-Amz-Credential field in the request is invalid.

Causes

You initiated a request that uses an Amazon S3-compatible V4 signature. However, the value of the X-Amz-Credential field is invalid.

Examples

You initiated a request that uses an Amazon S3-compatible V4 signature in the URL parameter. However, the value of the X-Amz-Credential field in the request is invalid.

GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=ab2***st HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: true

The X-Amz-Credential field that specifies the signature inforamtion is required in the request. The value of the X-Amz-Credential field must be in the following format: <YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request.

Solutions

Specify a valid value for the X-Amz-Credential field, such as X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request. Then, make sure that the fields in the request are complete and the values of the fields are valid. The following sample code provides an example on how to specify these fields:

GET /test.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LTAI****************/20221220/us-east-1/s3/aws4_request&X-Amz-Date=20221220T084818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=ab2s**** HTTP/1.0
Date: Tue, 20 Dec 2022 08:48:18 GMT
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
x-oss-s3-compat: true

We recommend that you use Amazon S3 SDKs to initiate the request. For more information, see Use Amazon S3 SDKs to access OSS.