I have use case when user which is not logged in-app, try to open some page.
He is redirected on /login
page, I need to get that URL which user tries to open.
In the authenticate
method I Add next code:
return (req: Express.Request) => {
// then with **req.originalUrl** I will get the URL which users execute
// But my app does not work, it's stuck like loading the initial page all the time, without content
}
Here is entire function:
public static authenticate(isRedirect = false) {
return (req: Express.Request) => {
return passport.authenticate('jwt', {
session: false,
...(isRedirect && { failureRedirect: `/login?redirectUrl=${req.originalUrl || ''}` })
});
};
}
How to get that req.originalUrl
but to my app steal works as before?