{"action":"created","issue":{"url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/73","labels_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/73/comments","events_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/73/events","html_url":"https://github.com/auth0/node-jsonwebtoken/issues/73","id":65556045,"number":73,"title":"Sign token, generate different token","user":{"login":"Rafailong","id":945197,"avatar_url":"https://avatars.githubusercontent.com/u/945197?v=3","gravatar_id":"","url":"https://api.github.com/users/Rafailong","html_url":"https://github.com/Rafailong","followers_url":"https://api.github.com/users/Rafailong/followers","following_url":"https://api.github.com/users/Rafailong/following{/other_user}","gists_url":"https://api.github.com/users/Rafailong/gists{/gist_id}","starred_url":"https://api.github.com/users/Rafailong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rafailong/subscriptions","organizations_url":"https://api.github.com/users/Rafailong/orgs","repos_url":"https://api.github.com/users/Rafailong/repos","events_url":"https://api.github.com/users/Rafailong/events{/privacy}","received_events_url":"https://api.github.com/users/Rafailong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-31T21:55:29Z","updated_at":"2015-04-25T14:15:20Z","closed_at":null,"body":"Hi there, I am using this module with a express.js application and also using express-jwt.\r\n\r\nWell,  in the login process each time a post to the /login url a new token is generated and saved to redis. I have a validation that if a token exists it wont be set to redis. but each time a token is signed/generated it is different even when I use the same secret string and the same payload.\r\n\r\nThe code is\r\n\r\n`\r\nvar data = {\r\n    _id: user.id,\r\n    username: user.nickname,\r\n    email: user.email,\r\n    token: jsonwebtoken.sign({ _id: user.id }, 'secret', {\r\n      expiresInMinutes: TOKEN_EXPIRATION\r\n    })\r\n  };\r\n`\r\n\r\nBut the `data.token` each post to /login route is different and it's set to redis.\r\n\r\nCan you help me?\r\n\r\nRegards!"},"comment":{"url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/comments/96210948","html_url":"https://github.com/auth0/node-jsonwebtoken/issues/73#issuecomment-96210948","issue_url":"https://api.github.com/repos/auth0/node-jsonwebtoken/issues/73","id":96210948,"user":{"login":"jfromaniello","id":178512,"avatar_url":"https://avatars.githubusercontent.com/u/178512?v=3","gravatar_id":"","url":"https://api.github.com/users/jfromaniello","html_url":"https://github.com/jfromaniello","followers_url":"https://api.github.com/users/jfromaniello/followers","following_url":"https://api.github.com/users/jfromaniello/following{/other_user}","gists_url":"https://api.github.com/users/jfromaniello/gists{/gist_id}","starred_url":"https://api.github.com/users/jfromaniello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfromaniello/subscriptions","organizations_url":"https://api.github.com/users/jfromaniello/orgs","repos_url":"https://api.github.com/users/jfromaniello/repos","events_url":"https://api.github.com/users/jfromaniello/events{/privacy}","received_events_url":"https://api.github.com/users/jfromaniello/received_events","type":"User","site_admin":false},"created_at":"2015-04-25T14:15:20Z","updated_at":"2015-04-25T14:15:20Z","body":"Moreover you dont need to store it on redis. It is digital signed, so\ninstead of checking if its on redis you can validate its signature. Search\nfor HMAC\n\nEl sáb, abr 25, 2015 10:36, ramon liu <notifications@github.com> escribió:\n\n> sure it's different, obviously the token contains timestamp. Your logic is\n> not correct. Your client request should contains token all the time. So on\n> server side just check if the request has token, if not, then create one\n> and save it; if yes verify it.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/auth0/node-jsonwebtoken/issues/73#issuecomment-96204351>\n> .\n>\n"}}