繁体   English   中英

如何在node-oidc-provider中重定向失败的登录尝试

[英]How do I redirect a failed login attempt in node-oidc-provider

我正在使用node.js,express.js和node-oidc-provider设置OpenID Connect提供程序。 我一直在通过https://github.com/panva/node-oidc-provider-example/tree/master/03-oidc-views-accounts上的示例进行操作,但是它永远不会处理失败的身份验证。 如果用户输入了错误的密码,如何将用户重定向回登录页面?

expressApp.get('/interaction/:grant', async (req, res) => {
// The initial route hit by the client (Relying Party) that renders the login view if needed.
...
});

expressApp.post('/interaction/:grant/login', parse, (req, res, next) => {
        User.authenticate(req.body.email, req.body.password)
            .then((users) => {
             // returns an array of user objects that match the credentials
              if(!users.length)
              {
              // What now?  I can't just redirect back to /interaction/:grant - I get session not found

              }
      // the rest works well enough (for now)....
...
            }).catch(next);
      });

就像在任何快速应用中一样。 这样想吧。 仅成功解决交互问题,否则,如果您希望退出交互并将控制权交还给客户端,则会出错。

我倾向于单独开发交互,只有在完成后才将它们插入oidc-provider。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM