这是代码 var https=require(‘https’);
var options = { hostname: ‘api.cnblogs.com’, port:‘443’, path: ‘/token’, method: ‘post’, auth: ‘Basic clientId:clientSercre’ };
var req = https.request(options, function(res){ console.log(‘状态码:’, res.statusCode); console.log(‘请求头:’, res.headers);
res.on('data', function(d) {
console.log('d:'+d);
});
});
req.on(‘error’, function(e) { console.error(‘e:’+e); }); req.end();
错误信息是{“error”:“invalid_clientId”,“error_description”:“Client Id format is invalid”}