I am current facing a challenge with a GET Request using the "request-promise" library. Currently Using Javascript with WedriverIO. The response that I get is a validation error or "Resource Owner Cancelled Authentication" error.
Please can someone assist me and let me know if my code below is incorrect or what the best practice in doing this.
var fs = request = require('request-promise');
exports.request = async function () {
const params = {
uri: 'https://api-boxdev.abcportal.com' +'/abc/openportal/javawebtokenfrontend',
rejectUnauthorized: false,
method: 'GET',
headers: {
'User-Agent': "request",
Authorization: "Bearer "+ global_accessTokenVal
}
//commented out
// headers = new Headers({ 'User-Agent': 'Request-Promise', 'Authorization': 'Bearer ' + global_accessTokenVal })
};
await request.get(params, async function Callback(error, response, body) {
storecallbackJWTerror = error;
storecallbackJWTResponse = response;
storecallbackJWTBody = body;
bodyResponse = JSON.parse(body)
})
};