create jwt token python

Solutions on MaxInterview for create jwt token python by the best coders in the world

showing results for - "create jwt token python"
Leane
20 Aug 2020
1pip install pyjwt
2
3>>> import jwt
4>>> encoded_jwt = jwt.encode({"some": "payload"}, "secret", algorithm="HS256")
5>>> print(encoded_jwt)
6eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U
7>>> jwt.decode(encoded_jwt, "secret", algorithms=["HS256"])
8{'some': 'payload'}