diff --git a/src/index.js b/src/index.js index b90a47d..606f11c 100644 --- a/src/index.js +++ b/src/index.js @@ -44,6 +44,10 @@ const applyConfig = (config) => { // - header user is different from token user // - token has no expiration // - token is expired + console.log("USER: ", user); + console.log("TOKEN: ", jwtDecode(token)); + console.log("TOKEN SCADUTO: ", jwtDecode(token).exp < Date.now() / 1000); + console.log("CONDIZIONE: ", ((user && jwtDecode(token).sub !== user) || !jwtDecode(token).exp || jwtDecode(token).exp < Date.now() / 1000)); if ((user && jwtDecode(token).sub !== user) || !jwtDecode(token).exp || jwtDecode(token).exp < Date.now() / 1000){ // TODO: eventually add base_url to a relative settings.loginUrl return res.redirect(`${settings.loginUrl}?came_from=${req.url}`);