bug: Signature for this request is not valid.
kojoakyer opened this issue · comments
kojoakyer commented
Short Description:
- im nit able to fetch data form binance api, i have set everything right but i keep getting Signature for this request is not valid.
var apiSecret = process.env.SECRET_KEY
const getParameters = async ()=>{
const response = await fetch('https://api.binance.com/api/v3/time',{
headers:{
"X-MBX-APIKEY":process.env.API_KEY
}
})
const {serverTime}= await response.json()
const query_string = timestamp=${serverTime}
;
const signature = crypto
.createHmac('sha256', apiSecret)
.update(query_string)
.digest('hex')
console.log(serverTime);
console.log(signature);
return {serverTime,signature}
}
try{
const {serverTime,signature}= await getParameters()
const response = await fetch(`https://api.binance.com/api/v3/order?symbol=${base}×tamp=${serverTime}&signature=${signature}`,{
headers:{
"X-MBX-APIKEY":process.env.API_KEY,
"signature":signature
}
})
.then((response) => response.json())
.then((data) => console.log(data));
// console.log(response);
res.status(200).json(response)
- windows
nodejs version: