errorCode: "accountNotAuth", errorMessage: "You aren't authorized"
qadirsuh opened this issue · 1 comments
qadirsuh commented
I am writing my own passwork-js APIs wrappers.
I am getting the following error while executing the /api2/getData
{response: false, errorCode: "accountNotAuth", errorMessage: "You aren't authorized", error: "accountNotAuth"}
What I have done so for per your docs
- Open a new session using openSession => Success
I got the session code and passing it to my next request i.e getData endpoint but it failed to get all passwords. I am getting this response.
{response: false, errorCode: "accountNotAuth", errorMessage: "You aren't authorized", error: "accountNotAuth"}
Here is my code
sendAuthRequest(config, urlPath, sessionCode) {
return new Promise(function(resolve, reject) {
//set url
var url = config.url + '' + urlPath;
//set header
var headers = {
'Content-Type' : 'application/x-www-form-urlencoded'
};
//set form data
var form = {session: sessionCode};
//set request parameter
request.post({headers: headers, url: url, form: form, method: 'POST'}, function (error, response, body) {
if(error || response.statusCode !== 200){
console.log("====================================");
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response.statusCode); // Print the response status code if a response was received
console.log("====================================");
reject(error);
}else{
body = JSON.parse(body.trim());
console.log("body", body);
resolve(body);
}
});
});
}
Whats wrong in here?
Note: The error above is not defined in your docs too. I don't find any clue where to go from here.
qadirsuh commented
BTW, when I try the to execute the getData endpoint in postman its working fine. I am getting my all passwords over there.