I´m struggling with this because I´m using a CAS authentication in my work.
When login is successful you're redirected to the previous URL but the problem is that is not redirecting to the previous URL is redirected to the base URL+ first param here is an example of how is all of this "working":
So the express route is something like this:
if (req.isAuthenticated()) {
//console.log("valor token: ", req.session.token);
next(); // permitir la siguiente ruta
} else {
// requerir al usuario log in cuando no es desarrollo
if (environment === 'development' ) {//|| environment === 'staging') {
//res.redirect("/cstools" + "?path=" + req.path);
next();
} else {
//console.log(req, req.url);
res
.cookie("redirect", "1", { httpOnly:false, path: "/cstools", secure: false })
.redirect("/cstools" + "?path=" + req.path);
}
}
});
Here it is the url I´m using:
/cstools/private/soporteOnLine/#/app/inicio/sugerencia/modal
but when is called in the browser the backend only gets the first param after private
/cstools/private/soporteOnLine
My first approach was to create a cookie for telling the browser to redirect to the previous URLbut as I am only getting one parameter so I cannot redirect to the URL that I want
My question here is how can I get the full URL for redirect when login is successful