The JS language always appears to be signed incorrectly when accessing the extension API.

Author: mingren1992, Created: 2019-10-10 19:31:03, Updated:

Question. Currently, the examples of API extensions on the platform are given by PY and GO, where the section on signing is described as follows: first MD5 encryption and UTF-8 encoding, I see that PY is directly introduced into the library, but JS does not have UTF-8 encoding functions?

Both methods and accessKey have a value before them.

var d = { version: ‘1.0’, access_key: accessKey, method: method, args: [], nonce: _N(UnixNano() / 1000000, 0), } var m = d.version + “|” + d.method + “|” + d.args + “|” + d.nonce + “|” + secretKey d.sign = HMAC(“md5”, “hex”, m, “pass”) var h = JSON.parse(HttpQuery(“https://www.fmz.cn/api/v1?access_key=”+accessKey+"&nonce="+d.nonce+"&args=%5B%5D&sign="+d.sign+"&version=1.0&method="+d.method))


More

The Little DreamI wrote one, the test is open, you can refer to it: What's up? function main (() { var accessKey = "" var secretKey = "" var method = "GetNodeList" What do you mean? Var d is equal to { Version: '1.0' is not available. access_key: accessKey, which is the key to access. method: method This is the first time I've seen this. nonce: (new Date (().getTime (()))) toString (()) I'm not sure. What do you mean? var m = d.version + "go ahead" + d.method + "go ahead" + d.args + "go ahead" + d.nonce + "go ahead" + secretKey d.sign = Hash (("md5", "hex", m) What do you mean? This is a list of all the different ways AccessKey is credited in the database, sorted by country. Log ((ret)) I'm not sure. What's up? accessKey, secretKey. You can fill in your own KEY.

The Little DreamThis extension API is generally used to call independent programs. It is not usually written in a call policy.

The Little DreamIt can't be called in JS policy because there is no way to reference its own library, Python can, because Python can reference the library it needs at will.

The Little DreamI'm not being polite.

mingren1992Thank you very much.