I am trying to integrate paypal in my app and i got 400 error [unsupported_grant_type] Grant Type is NULL
axios
.post(
'https://api.sandbox.paypal.com/v1/oauth2/token',
{ grant_type: 'client_credentials' },
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
auth: {
username:
'clientId',
password:
'secret'
}
}
)
.then(response => {
console.log('response', response.data);
})
.catch(err => {
// console.log('error', { ...err });
console.log('error', err);
});
what i am doing wrong?
Note: it works fine in postman