首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在node-oidc-provider中重定向失败的登录尝试

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

Stack Overflow用户
提问于 2019-02-15 05:20:09
回答 1查看 1.1K关注 0票数 1

我正在使用node.js、express.js和OpenID -oidc- Provider设置节点连接提供程序。我一直在研究https://github.com/panva/node-oidc-provider-example/tree/master/03-oidc-views-accounts中的示例,但它从不处理失败的身份验证。如果用户输入了错误的密码,我如何将用户重定向回登录页面?

代码语言:javascript
复制
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);
      });
EN

回答 1

Stack Overflow用户

发布于 2019-02-16 06:47:26

就像在任何express应用程序中一样。这样想吧。如果您希望退出交互并将控制权交还给客户端,则仅解决成功或错误的交互。

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54699216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档