以下代码:
function getAddress() {
var kite = Meteor.npmRequire('coinkite-javascript');
sign = kite.auth_headers('somekey', 'somesecret', '/v1/new/receive');
console.log(kite.auth_headers('somekey', 'somesecret', '/v1/new/receive'));
console.log(Meteor.http.call("PUT", "https://api.coinkite.com/v1/new/receive", { params: { account: 'CA8A4C1B40-359DC0' } + sign}));
};
Meteor.startup(function () {
getAddress();
});
无论如何,这段代码因某些原因无效。 键生成器(符号)返回的JSON对象是:
{'X-CK-Key':'somekey','X-CK-Sign':'3655960c6ad67a0f3d57cd9468d375defcdae96587e6b5778e6dbbb9b6470568', 'X-CK-Timestamp':'2015-05-12T01:09:55.551Z'}
请求返回401表示未定义X-CK-KEY。
如何有效地将这些参数添加到放置请求中?
答案 0 :(得分:0)
根据Meteor documentation,您是否应该在headers
选项中发送身份验证标题?
function getAddress() {
var kite = Meteor.npmRequire('coinkite-javascript');
sign = kite.auth_headers('somekey', 'somesecret', '/v1/new/receive');
console.log(kite.auth_headers('somekey', 'somesecret', '/v1/new/receive'));
console.log(Meteor.http.call("PUT", "https://api.coinkite.com/v1/new/receive", { params: { account: 'CA8A4C1B40-359DC0' }, headers: sign}));
};
Meteor.startup(function () {
getAddress();
});