Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

nodejs怎么通过第三方api的oauth2

$
0
0

这是代码 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”}


Viewing all articles
Browse latest Browse all 14821

Trending Articles