问题描述
我有一个关于与ebay进行api集成的新问题。我想获取“用户访问令牌”,但我不能。我已使用“应用程序访问令牌”,“用户同意”,但未使用“用户访问令牌”。我正在研究node.js。如您在下面看到的代码所示,我正在获取应用程序访问令牌并将其发送以获取用户访问令牌。 Api给我一个错误,提示“发生了意外错误,请与资源提供商联系”。我已经为此工作了很长时间。我的问题是什么,我该怎么办?谢谢。 我已经阅读了ebay api文档上的几乎所有文档。我在做同样的事情,例如下面的文档。 https://developer.ebay.com/api-docs/static/oauth-authorization-code-grant.html
var axios = require('axios'); var qs = require(“ querystring”);
//The client credentials grant flow
//https://developer.ebay.com/api-docs/static/oauth-client-credentials-grant.html
axios("https://api.ebay.com/identity/v1/oauth2/token",{
method: "POST",headers: {
"Content-Type": "application/x-www-form-urlencoded","Authorization": "Basic " + Buffer.from(
//App ID (Client ID):
`orcas`
).toString('base64')
},data: qs.stringify({
grant_type: "client_credentials",scope: "https://api.ebay.com/oauth/api_scope",// parsed from redirect URI after returning from eBay,})
})
.then(response => {
console.log("Application data");
console.log(response.data.access_token);
axios("https://api.ebay.com/identity/v1/oauth2/token",{
method: "GET",header: {
"Content-Type": "application/x-www-form-urlencoded",Authorization: "Basic " + Buffer.from(
//App ID (Client ID):
`orcas`
).toString('base64')
},data: qs.stringify({
grant_type: "authorization_code",code: response.data.access_token,redirect_uri: "orcas"
})
})
.then(res => {
console.log("res.data");
console.log(res.data);
})
.catch(err => {
console.log("**************Get search error**************")
console.log(err)
});
})
.catch(err => {
console.log("**************Get access token error**************")
console.log(err)
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)