I'm trying to get access_token from a refresh token I got from eBay. I'm using Axios but I keep getting getting grant type in request is not supported error.
const refreshToken = 'xxxxxxxx';
const appID = 'xxxxxxx';
const certID = 'xxxxxx';
const scopes = [
'https://api.ebay.com/oauth/api_scope',
'https://api.ebay.com/oauth/api_scope/sell.fulfillment',
'https://api.ebay.com/oauth/api_scope/sell.account',
'https://api.ebay.com/oauth/api_scope/sell.inventory'
]
const params = {
grant_type: 'refresh_token',
refresh_token: refreshToken,
'scope': encodeURI(scopes.join(" ")),
// scope: scopes,
const token = Buffer.from(`${appID}:${certID}`);
const URL = 'https://api.ebay.com/identity/v1/oauth2/token'
const { data } = await axios.post(URL, params, {
'headers': {
'Authorization': `Basic ${token.toString('base64')}`,
'Content-Type': 'application/x-www-form-urlencoded',
},
})