1688开放平台获取access_token代码nodejs版本

发布日期:
const https = require('https');
const app = require("./lib/app")

const options = {
    hostname: 'gw.open.1688.com',
    port: 443,
    path: `/openapi/param2/1/system.oauth2/getToken/${app.appKey}?grant_type=refresh_token&client_id=${app.appKey}&client_secret=${app.appSecret}&refresh_token=${app.refresh_token}`,
    method: 'POST'
};

const req = https.request(options, (res) => {
    res.on('data', (d) => {
        process.stdout.write(d);
    });
});

req.on('error', (e) => {
    console.error(e);
});
req.end();