我已经在 OAuth 的第 1 步中毫无问题地检索了授权码,但在我的一生中,我无法完成一篇文章来获取访问 token 。我总是得到同样的错误:content: "{"error":"invalid_request","error_description":"Could not find Shopify API appli... (length: 103)"
这是我的代码的样子... Meteor.http.post 是一个标准的发布请求。我尝试了各种组合,但没有任何运气。我正在本地主机上开发:
var url = 'https://' + shopName + '/admin/oauth/access_token';
var data = { client_id: apiKey, client_secret: secret, code: code };
Meteor.http.post(url, data,
function(error, result) {
debugger;
});
Meteor.post 是标准的服务器端发布请求 documented here .我尝试过参数(如 Node Wrapper)、数组(如 PHP)和其他东西的组合。我不知道。
是不是因为我在本地主机上开发并且服务器调用现在需要 https?我的帖子数据结构错了吗?
任何其他想法我做错了什么?
最佳答案
我知道你说过你尝试过 params 但将 params 作为这样的数据放置是行不通的。尝试这个..
var url = 'https://' + shopName + '/admin/oauth/access_token';
var data = { client_id: apiKey, client_secret: secret, code: code };
Meteor.http.post(url, {params:data},
function(error, result) {
debugger;
});
关于oauth-2.0 - Shopify:获取 OAuth 访问 token 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14367387/