Code =
function getNewAccessToken(clientId, clientSecret) {
return new Promise((resolve, reject) => {
const options = {
method: ‘POST’,
url: ‘https://api.box.com/oauth2/token’,
headers: {
‘Content-Type’: ‘application/x-www-form-urlencoded’
},
form: {
grant_type: ‘client_credentials’,
client_id: clientId,
client_secret: clientSecret,
box_subject_type: ‘user’,
box_subject_id: ‘8777888766’
}
};
request(options, function (error, response, body) {
if (error) {
reject(error);
} else {
const parsedBody = JSON.parse(body);
if (parsedBody.access_token) {
console.log(parsedBody.access_token);
resolve(parsedBody.access_token);
} else {
reject(parsedBody);
}
}
});
});
}
I am getting the Error
}
{
error: ‘invalid_grant’,
error_description: ‘Grant credentials are invalid’
}
Please provide me a solution of it