What am I doing wrong?
I'm trying to get info of my account but something is not correct.
var apiKey = 'myAPIKey';
var secret = 'mySecret';
var queryString = 'timestamp=' + Date.now();
var hash = CryptoJS.HmacSHA256(queryString,secret);
var url = 'https://api.binance.com/api/v3/account?'+ queryString + '&signature=' +hash;
$('.botonOrden').click(function(){
$.ajax({
beforeSend: function(req){
req.setRequestHeader("X-MBX-APIKEY", apiKey);
},
type: 'GET',
url: url
})
.done(function() {
console.log("success");
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
The console says:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.binance.com/api/v3/account?timestamp=1522383455036&signature=MyHash.
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
I'm think I'm doing it as shown in the doc: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#signed-endpoint-examples-for-post-apiv1order