我正在尝试使用node-oauth验证对Withings API的请求,这是一个广泛使用的 Node 的 OAuth 模块。OAuth 流程的所有初始步骤都在工作,我能够获取用户 ID、访问令牌和访问令牌密码。但是,当尝试实际使用这些令牌发出经过身份验证的请求时,我收到以下错误之一:
- 2554错误的操作或错误的网络服务
- 2555发生未知错误
- 2556服务未定义
我已经通过在此处测试它们验证了我使用的凭据是有效的。我做错了什么,还是 Withings API 以某种非标准方式实现,这使得它与 node-oauth 不兼容?
var consumerKey = "";
var consumerSecret = "";
var oauth_access_token = "";
var oauth_access_token_secret = "";
var userid = "";
var oauth = require("oauth");
var withings = new oauth.OAuth(
"https://oauth.withings.com/account/request_token",
"https://oauth.withings.com/account/access_token",
consumerKey,
consumerSecret,
"1.0",
null,
"HMAC-SHA1"
);
var url = "http://wbsapi.withings.net/measure?action=getmeas&userid=" + userid;
withings.get(url, oauth_access_token, oauth_access_token_secret, function(error, response) {
console.log(response);
});
输出:
{"status":2554}