How does timed JSON web signature serializer work? How does timed JSON web signature serializer work? flask flask

How does timed JSON web signature serializer work?


By signing and sending the original token upon login the server basically gives the front end an all access ticket to the data the user would have access to, and the front end uses that token (golden ticket) on all future requests for as long as the token is not expired (tokens can be made to have expiration or not). The server in turn knows the token has not been tampered with, because the signature is basically the encrypted hash of the users recognizable data (user_id, username, etc). So, if you change the token information from something like:

{"user_id": 1}

to something like:

{"user_id": 2}

then the signature would be different and the server immediately knows this token is invalid.

This provides an authentication method that exempts the server from having to have a session, because it validates the token every time.

Here is an example of what a token could look like (itsdangerous can use this format of JSON web tokens)