Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk authored Feb 2, 2024
1 parent f29771b commit 23fbed0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit 23fbed0

Please sign in to comment.