I am trying to automate the response which is getting generated in the postman tool but getting the error 401 unqutorized error. tried to resolve in many ways by giving the exact security token to the authorization-token but it didnt worked out.
//In this method the security token passed is newly generated and it works fine and produces response 200 in postman tool
async claimsetResponseOP(SecurityToken:string){
var options = {
method: 'POST',
url: 'http://nhsappchna8086/LMHIAService/api/v3/ValueSet/$expand',
//Giving header to the request
headers: {
'Authorization-Token': SecurityToken, // Here is the place where the security token is passed in the headers
'Accept': 'application/json+fhir',
'Content-Type' : 'application/json+fhir',
'Authorization-Type' : 'Native'
},
body: {
"resourceType ": "Parameters",
"parameter": [
{
"name": "ValueSet",
"resource": {
"resourceType": "ValueSet",
"status": "active",
"compose": {
"include": [{
"system": "http://snomed.info/sct",
"filter": [{
"property": "constraint",
"op": "=",
"value": "<<(*:R363698007=271629002)"
}
]
}
]
}
}
}
]
},
json:true,
resolveWithFullResponse: true
};
//Error gets displayed in below line as Failed 401 unautorized error
await requestp(options).then(async function(response){
await requestp(options).then(async function(Content){
if (await response.statusCode == 200){
var info = Content.body;
}
})
})
}
Below error gets displayed while executing: Can anyone please help in resolving
Failed: 401 - {"resourceType":"OperationOutcome","id":"AUTH-01","text":{"status":"additional","div":"Unauthorised"},"issue": [{"severity":"error","code":"security","details":{"text":"9254 - Unauthorised"}}]}