【发布时间】:2019-06-30 18:10:03
【问题描述】:
实际上,我需要授权令牌,以便我可以将其作为标头传递,以在 node.js 中运行 azure 的“创建管道运行”api。但在这里我再次陷入困境,我得到了“连接 ETIMEDOUT”一次又一次的错误。
var AuthenticationContext = require('adal-node').AuthenticationContext;
var authorityHostUrl = 'https://login.windows.net';
var authorityUrl = authorityHostUrl + '/' + tenant;
var resource = 'https://localhost'; // URI that identifies the resource for which the token is valid.
var tenant = '';
var applicationId = '';
var clientSecret = '';
var context = new AuthenticationContext(authorityUrl);
context.acquireTokenWithClientCredentials(resource, applicationId, clientSecret, function(err, tokenResponse) {
if (err) {
console.log('well that didn\'t work: ' + err.stack);
} else {
console.log(tokenResponse);
}
});
它显示以下错误
well that didn't work: Error: tunneling socket could not be established, cause=connect ETIMEDOUT 10.0.0.2:8080
at ClientRequest.onError (/home/deepti/Desktop/AADL/AADL/node_modules/tunnel-agent/index.js:177:17)
at Object.onceWrapper (events.js:286:20)
at ClientRequest.emit (events.js:198:13)
at Socket.socketErrorListener (_http_client.js:392:9)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
谁能指出错误?
【问题讨论】:
标签: node.js azure azure-active-directory