【发布时间】:2015-10-27 17:23:37
【问题描述】:
我正在使用 https://github.com/AzureAD/passport-azure-ad 将 nodejs 应用程序与 Azure AD 集成。
我使用 OIDCStrategy 将用户登录到我的 node.js 应用程序。
这是我的代码:
(passport.use(new OIDCStrategy({
callbackURL: config.azureadCreds.callbackURL,
realm: config.azureadCreds.realm,
clientID: config.azureadCreds.clientID,
clientSecret: config.azureadCreds.clientSecret,
scope: "openid offline_access profile Directory.Read UserProfile.Read",
identityMetadata: config.azureadCreds.identityMetadata,
skipUserProfile: config.azureadCreds.skipUserProfile,
responseType: config.azureadCreds.responseType,
responseMode: config.azureadCreds.responseMode,
passReqToCallback: true
},
function (iss, sub, profile, claims, accessToken, refreshToken, params, done) {
request.get("https://graph.windows.net/<my-tenant-id>/me?api-version=1.5", {
'headers': {
'Authorization': "Bearer " + params["id_token"],
'Content-Type': 'application/json'
}
}, function(err, res, body){
if(err){
console.log("err: " + err);
}
else{
console.log("res: " + res);
}
done();
});
})));
但是我无法得到任何回应。我尝试了各种配置,但都没有运气。
【问题讨论】: