I have a problem here. I'm trying to get my account info via Node.js(Axios) But I'm getting this 401 unauthorized error. Can you help me?
Here is the documentation. https://github.com/Bitrue/bitrue-official-api-docs/blob/master/rest-api.md
const axios = require('axios')
const crypto = require('crypto')
const apikey = "461d7cd32bbecb53e1a366f5f178a0edfb403f60f63fc86ad4fd7cf1776f00ef"
const secretKey = "946dab362d2ff1936dc077f100fa5ad791d8dc984c4a0c471256a5c59eaa876a"
const host_Bitrue = "https://www.bitrue.com"
const timestamp = Date.now()
const recvWindow = 5000
const name = crypto.createHmac("sha256", secretKey)
.update(`timestamp=${timestamp}&recvWindow=${recvWindow}`)
.digest("hex");
const sending_data = `timestamp=${timestamp}&signature=${name}&recvWindow=${recvWindow}`
console.log(name)
axios.get(host_Bitrue + '/api/v1/account?' + sending_data, {
headers: {
"X-MBX-APIKEY": apikey
}
})
.then(data => {
return console.log(data)
})
.catch(err => {
console.log(err)
})
I need your help. Thank you.
question from:
https://stackoverflow.com/questions/66059148/bitrue-exchange-cant-access-via-axios-error-401-unauthorized 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…