成功login后,Azureauthentication返回到login页面 – node.js
我有一个node.js应用程序,并将其上传到Azure。 我已经将Active Directory支持包括在我们的应用程序中。 使用高级选项,我已经设置客户端ID和所需的细节到应用程序。
在Node.js应用程序中,我使用passport-azure-ad来validation用户。 我已经configuration了客户端ID,秘密,返回url等,我用下面的get方法来调用蔚蓝authentication。
app.get('/login', passport.authenticate('azuread-openidconnect', { failureRedirect: '/hello' }), function(req, res){ res.sendFile(path.join(__dirname+'/views/index.html')); });
当我部署代码并在Azure中运行它时,它首先将我带到azure色的login页面,一旦input正确的电子邮件和密码,它就会再次将我redirect到login页面。 它也没有抛出任何错误。
请帮忙避免这个redirect到login页面的循环过程。 提前致谢。
请检查您在configuration和Azure AD应用程序的configuration中设置了returnURL
Url。 完成身份validation后,它将返回此端点。
例如
你设置returnURL
为http://localhost:3000/auth/openid/return
,你需要检查路由/auth/openid/return
就好,
app.get('/auth/openid/return', passport.authenticate('azuread-openidconnect', { failureRedirect: '/login' }), function(req, res) { log.info('We received a return from AzureAD.'); res.redirect('/'); });
在你的应用程序。 无论是redirect到login页面,还是authentication失败。
- Laravel 5:使用Laravel会话数据的Socket.io客户机authentication
- 没有Passport.js的Google +身份validation
- 如何使用Passport保护路线终点?
- 基于令牌的authentication(在Node.js中)
- Node.js中使用http.client进行摘要式身份validation的问题
- 要求Passport.js / Node.js目录(除了一个页面)的身份validation?
- SPA和SSO中无状态身份validation的性能(单点login)
- 如何密码保护Harp.js应用程序的子目录
- Auth0 req.user.sub返回false