Hi All,
im just trying to get HMAC working correctly with the Testnet endpoints.
Can anyone advise what’s wrong below. as I keep getting **Error: Request failed with status code 401
**
const CREATE_ORDER = 'https://testnet.binance.vision/api/v3/order'
const BINNANCE_KEY = '225HZwKyZxxeOMUcoo4KcCf1HjQtBuk9Oa850YFseKZdMM4ZuU88vWtJMOH0BYR0'
const BINNANCE_SECRET = 'JLVx4l8DVL9v261GYYLtLXTH0EGT7FD2WXIlcr4HdjbV2xVYH8vAwl84tg5hFgHL'
const str = `symbol=LTCBTC&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=${Date.now()}`
const signature = createHmac('SHA256', BINNANCE_SECRET).update(str).digest('hex');
try{
const resp = await axios.post(`${CREATE_ORDER}?${str}&signature=${signature}`,<AxiosRequestConfig>{
header: {
'X-MBX-APIKEY':BINNANCE_KEY
}
})
console.log(resp);
}catch (e){
console.log(e);
}
data: '{"header":{"X-MBX-APIKEY":"TjwFmaMtRp7HguJvENABg7nXCmtYq6clIjEoeMQquj0qgdPg7P8xjY9TN53XSBgs"}}',