I am attempting to assign the body of the callback function to assign it to a variable.
const request = require('request');
async function getAPIToken(options){
let token = await request(options, (error, response, body)=> {return body})
return token
}
let token1 = getAPIToken(options);
console.log(token1)
This returns promise pending, however when I use token1.then((a)=> {console.log(a)}) it returns the request not the body.