1

I want to generate a signature for Bingx website Api
Here's my code:

const Base64 = require('crypto-js/enc-base64');
const hmacSHA256  = require('crypto-js/hmac-sha256');

let originString = 'POST/api/v1/user/getBalanceapiKey=my_api_key' + '&currency=USDT&timestamp=' + Date.now();
let signature = hmacSHA256(originString, my_secret_key);
signature = Base64.stringify(signature);
signature = encodeURIComponent(signature);

I send the signature to the api But I get this error "signature not match"

Here's the bingx api authentication documentation: link1 and link2

developer
  • 170
  • 2
  • 12
  • The origin string that you are generating for the signature is not formatted correctly. The string should be in the format of [HTTP method] + [URL] + [param1=value1] + [param2=value2] + ... and the params should be sorted alphabetically. – Silent observer Jan 11 '23 at 09:27
  • @Silentobserver I Check again, the origin string is formatted as the same as you wrote. Could you modify the origin string and send it please? – developer Jan 11 '23 at 09:34

0 Answers0