Skip to content
Discussion options

You must be logged in to vote

As I can see - it's impossible now. But you can recreate token by the same data and it will work like update.

For example:

import datetime
from time import sleep

from jose import jwt
from jose.exceptions import ExpiredSignatureError


if __name__ == "__main__":

    data = {"bearer": "It's an example of bearer"}
    secret = "Secret key"
    expired = 5

    data["exp"] = datetime.datetime.utcnow() + datetime.timedelta(
        seconds=expired
    )

    token = jwt.encode(data, secret)

    print(token)

    sleep(expired + 1)

    try:
        decrypted = jwt.decode(token, secret)
    except ExpiredSignatureError:
        data["exp"] = datetime.datetime.utcnow() + datetime.timedelta(
 …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Kludex
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
3 participants
Converted from issue

This discussion was converted from issue #1744 on February 28, 2023 01:11.