Redirects in infinite loop if a body parser is not set up for express
See original GitHub issueMinor, but should be documented: when defining the callback route:
let app = express()
app.get('/login', passport.authenticate('saml', { failureRedirect: '/' }), (req, res) => res.redirect('/'))
app.post('/callback', passport.authenticate('saml', { failureRedirect: '/' }), (req, res) => res.redirect('/'))
There needs to be middleware that supports body parsing, otherwise (in my case) it starts redirecting between my IdP and my app indefinitely.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:10
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Express Authentication Redirects Leading to Infinite Loop
The ensureAutheticated will check whether your code is authenticated or not.Not need to redirect it every time through the login route.
Read more >URL Rewriting Middleware in ASP.NET Core - Microsoft Learn
It's easy to accidentally create a loop of infinite redirects. The part of the expression contained within parentheses is called a capture ...
Read more >Node.js best practices list (July 2021) - DEV Community
1. Project Structure Practices · 1.1 Structure your solution by components · 1.2 Layer your components, keep the web layer within its boundaries....
Read more >Creating a Basic To-Do App with Node.js
The event loop is an infinite loop and is the only thread available. The event mechanism helps the server to respond in a...
Read more >18.4.2 API Reference - hapi.dev
If not configured, defaults to host if present, otherwise to all available ... listed returned a non-error response (e.g. a redirect to a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also had the same issue. Adding the
bodyParser
finally resolved it. 😅Wasted days chasing this infinite loop issue. Many thanks to OP for creating this issue. There is no mention of it in documentation. 😞