如何将 HMAC SHA 256 密钥发送到 binance api?
how to send HMAC SHA 256 Secret key to binance api?
我写这段代码:
api_key = "https://api.binance.com/api/v3/myTrades??X-MBX-APIKEY="+config.API_Key+"&signature="+config.Secret_Key
并得到这个错误:
{"code":-2014,"msg":"API-key format invalid."}
这是 binance 的文档 api
https://binance-docs.github.io/apidocs/spot/en/#endpoint-security-type
您需要将 X-MBX-APIKEY
作为请求 header 传递,而不是 GET 参数。
不幸的是,您的代码没有显示您是如何构建请求的,但这里有一个使用 axios:
的示例
axios({
url: 'https://api.binance.com/api/v3/myTrades',
method: 'get',
headers: {
'X-MBX-APIKEY': config.API_Key
}
}).then((response) => {
console.log(response);
})
我写这段代码:
api_key = "https://api.binance.com/api/v3/myTrades??X-MBX-APIKEY="+config.API_Key+"&signature="+config.Secret_Key
并得到这个错误:
{"code":-2014,"msg":"API-key format invalid."}
这是 binance 的文档 api https://binance-docs.github.io/apidocs/spot/en/#endpoint-security-type
您需要将 X-MBX-APIKEY
作为请求 header 传递,而不是 GET 参数。
不幸的是,您的代码没有显示您是如何构建请求的,但这里有一个使用 axios:
的示例axios({
url: 'https://api.binance.com/api/v3/myTrades',
method: 'get',
headers: {
'X-MBX-APIKEY': config.API_Key
}
}).then((response) => {
console.log(response);
})