Generating signature¶
The signature should be generated as follows:
sort request parameters by their names
for each parameter, concatenate its key and value as a string
concatenate all such strings for all parameters
append the resulting string with the app secret
the sha256 hash of the resulting string in hexadecimal form should be used as the signature
Sample in Node.js:
javascript
function genSign(params, apiSecret) {
var paramsStr = Object.keys(params).sort().map(function(key) {
return key+params[key];
}).join('') + apiSecret;
return crypto.createHash('sha256').update(paramsStr).digest('hex');
}