微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Bitrue exchange.Cant 访问通过 axios.Error 401 未授权

如何解决Bitrue exchange.Cant 访问通过 axios.Error 401 未授权

我这里有问题。我正在尝试通过 Node.js(Axios) 获取我的帐户信息,但是我收到了这个 401 未经授权的错误。你能帮我吗?

这是文档。 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)
    })

我需要你的帮助。谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。