Nodejs redirect to intended URL after login

Here’s how to do this in node:

Inside the API that you use to apply the security restrict, you can save $_SERVER.PATH_INFO in a session variable. You only do this if the user is not logged in and you do it before the security restrict is applied.

Then on successful login you need to redirect the user to that path if that session variable exists and remove the session variable. For example, in mine I output a redirect_path after a successful login:

I then do a browser.goto on success of the login form:

4 Likes