json-web-token

JSON Web Token (JWT) benefits over a database session token

狂风中的少年 提交于 2019-11-29 19:11:58
With a database session token system I could have a user login with a username/password, the server could generate a token (a uuid for example) and store it in the database and return that token to the client. Every request from thereon would include the token and the server would look up whether the token is valid and what user it belongs to. Using JWT there would be no need to save anything to the database with respect to session/tokens thanks to the combination of the secret key kept on the server and the signed token the client keeps and sends with every request. This is good but besides

implementing refresh-tokens with angular and express-jwt

元气小坏坏 提交于 2019-11-28 17:40:47
I want to implement the Sliding expiration concept with json web tokens using angular, nodejs and express-jwt. I'm a little confused on how to do this, and am struggling to find any example of refresh tokens or and other material relating to sessions with these technologies/frameworks. A few options I was thinking of were Generating a new token with each request after the initial login Keeping track of issued token on the server side along But I'm honestly not sure, please help almoraleslopez I managed to implement this scenario. What I've done... On the server: -Enable an API endpoint for