Hi,
UnAuthorized Access (1401) Exception comes when signature is false.
There are different reasons behind it:
- Either your API Key & Secret Key is not correct
- Or the device time is not correct on which app is running, i.e. time stamp is not correct while making the request.
- The post body is not a valid json etc.
You can check these things inside InsertJsonDocument API code:
map<string, string> signParams;
string timestamp = Util::getTimeStamp();
populateSignParams(signParams);
signParams["dbName"] = dbName;
signParams["collectionName"] = collectionName;
string storageBody = BuildStorageBody(json);
signParams["body"] = storageBody;
string signature = Util::signMap(secretKey, signParams);
The above code is responsible for creating the signature, you can go through it and check what is going wrong.
If possible, please print the signParams, headers and URL and share with us so that we can also try to detect what is wrong in the request params.
Let us know if you need any other info related to this.