1.鑒權(quán)接口獲取accessToken
request({
? ? ? ? ? ? ? ? url: "https://" + nalot.host + ":" + nalot.port + "/iocm/app/sec/v1.1.0/login",
? ? ? ? ? ? ? ? headers: {
? ? ? ? ? ? ? ? ? ? "content-type": "application/x-www-form-urlencoded"
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? rejectUnauthorized: false,
? ? ? ? ? ? ? ? method: "POST",
? ? ? ? ? ? ? ? body: str,
? ? ? ? ? ? ? ? agentOptions: {
? ? ? ? ? ? ? ? ? ? pfx: fs.readFileSync(nalot.p12),
? ? ? ? ? ? ? ? ? ? passphrase: nalot.password,
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }, function (error, response, body) {
? ? ? ? ? ? ? ? if (!error && response.statusCode == 200) {
? ? ? ? ? ? ? ? ? ? resolve(body);
? ? ? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? ? ? reject(error)
? ? ? ? ? ? ? ? }
? ? ? ? ? ? });
agentOptions 需要上傳p12證書和密鑰合呐,摸索了1天,才找到解決方案