我正在尝试从我从 eBay 获得的刷新令牌中获取 access_token。我正在使用 Axios,但我不断收到不支持请求中的授权类型错误。
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',
},
})