You may encounter the following errors related to IAM authentication information:
{ "error_msg": "Incorrect IAM authentication information: verify aksk signature fail, ...... "error_code": "APIG.0301", "request_id": "******" }
Possible Cause
The signature algorithm is incorrect, and the signature calculated by the client is different from that calculated by APIG.
Solution
2019/01/26 11:34:27 [error] 1211#0: *76 [lua] responses.lua:170: rewrite(): 473a4370fbaf69e42f9da243eb8f8c52;app-1;Incorrect IAM authentication information: verify signature fail;SDK-HMAC-SHA256 Access=071fe245-9cf6-4d75-822d-c29945a1e06a, SignedHeaders=host;x-sdk-date, Signature=b2ef2cddcef89cbfe22974c988909c1a94b1ac54114c30b8fe083d34a259e0f5;canonicalRequest:GET /app1/ host:test.com x-sdk-date:20190126T033427Z host;x-sdk-date e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, client: 192.168.0.1, server: shubao, request: "GET /app1 HTTP/1.1", host: "test.com"
Language |
Function |
---|---|
Java |
Sign function in com.cloud.sdk.auth.signer.DefaultSigner.class of libs/java-sdk-core-*.jar |
C |
sig_sign function in signer.c |
C++ |
Signer::createSignature function in signer.cpp. |
C# |
Sign function in signer.cs |
Go |
Sign function in signer.go |
JavaScript |
Signer.prototype.Sign function in signer.js |
Python |
Sign function in signer.py |
PHP |
Sign function in signer.php |
Example: cannonicalRequest obtained at a debug interrupt
POST /app1/ host:test.com x-sdk-date:20190126T033950Z host;x-sdk-date e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Line No. |
Parameter |
APIG |
Client |
---|---|---|---|
1 |
Request method |
GET |
POST |
2 |
Request path |
/app1/ |
/app1/ |
3 |
Request parameters |
None |
None |
4 |
Request header |
host:test.com |
host:test.com |
5 |
Request header |
x-sdk-date:20190126T033427Z |
x-sdk-date:20190126T033950Z |
6 |
Blank line |
- |
- |
7 |
Request header parameters |
host;x-sdk-date |
host;x-sdk-date |
8 |
Request body hash value |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
{ "error_msg": "Incorrect IAM authentication information: AK access failed to reach the limit,forbidden." ...... "error_code": "APIG.0301", "request_id": "******" }
Possible Causes
{ "error_msg": "Incorrect IAM authentication information: decrypt token fail", "error_code": "APIG.0301", "request_id": "******" }
Possible Cause
The token cannot be parsed for IAM authentication of the API.
Solution
{ "error_msg": "Incorrect IAM authentication information: Get secretKey failed,ak:******,err:ak not exist", "error_code": "APIG.0301", "request_id": "******" }
Possible Cause
The AK used for IAM authentication of the API does not exist.
Solution
Check whether the AK is correct.