'can I generate listenKey binance in app script

I try a lot of think to create listenKey in app script but nothing work. the binance URL: https://binance-docs.github.io/apidocs/spot/en/#user-data-streams

this is my code:

function generated_key() {

  var aPIKEY = '*****'; // key.
  var secretKey = '****'; // Secret key.

  var api = "/api/v3/userDataStream";
  var timestamp = Number(new Date().getTime()).toFixed(0);
  var string = "timestamp="+timestamp;

  var baseUrl = "https://api1.binance.com";
  var signature = Utilities.computeHmacSha256Signature(string, secretKey);
    signature = signature.map(function(e) {
        var v = (e < 0 ? e + 256 : e).toString(16);
        return v.length == 1 ? "0" + v : v;
  }).join("");
  var query = "?" + string + "&signature=" + signature;
  var params = {
        'method': 'POST',
        'headers': {'X-MBX-APIKEY': aPIKEY},
        'muteHttpExceptions': true
  };
  var data = UrlFetchApp.fetch(baseUrl + api + query, params);
  var obj = JSON.parse(data); // To JSON
  Logger.log(obj)
}

I get the result error: {code=-1101.0, msg=Too many parameters; expected '0' and received '2'.} any suggestion to do it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source