【问题标题】:404 Not Found from redirectURL in Azure AD- OAuth/PassportJS从 Azure AD-OAuth/PassportJS 中的 redirectURL 找不到 404
【发布时间】:2019-03-15 07:54:09
【问题描述】:

我正在尝试使用PassportJSpassport-azure-ad 实现从Microsoft Azure AD 到我的Node 应用程序的OAuth 日志记录,但是每次我发送给我的提供商时,我的路由https://localhost:3000/auth/openid/return 都会返回404 Not found。

Azure 中的一切都设置妥当

这是我的代码:

passport.use(new OIDCStrategy({
        clientID: clientID,
        clientSecret: clientSecret,
        identityMetadata: "https://login.microsoftonline.com/<tenant-name>.onmicrosoft.com/v2.0/.well-known/openid-configuration",
        responseType: "code id_token",
        responseMode: "form_post",
        redirectUrl: "https://localhost:3000/auth/openid/return",
        passReqToCallback: false
    }, function() {
        console.log("Goin here");
    }));

以下是路线:

router.get('/login', passport.authenticate('azuread-openidconnect'));

router.get('/auth/openid/return', function(req, res, next) {
res.send('callback route');
});

我是不是做错了什么?

【问题讨论】:

    标签: node.js express oauth azure-active-directory passport.js


    【解决方案1】:

    所以我只是将responseMode 属性更改为query 并且工作正常!

    【讨论】:

      猜你喜欢
      • 2021-03-15
      • 1970-01-01
      • 2017-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多