Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python jwt

>>> import jwt
>>> private_key = b"-----BEGIN PRIVATE KEY-----
MIGEAgEAMBAGByqGSM49AgEGBS..."
>>> public_key = b"-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEAC..."
>>> encoded = jwt.encode({"some": "payload"}, private_key, algorithm="RS256")
>>> print(encoded)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg
>>> decoded = jwt.decode(encoded, public_key, algorithms=["RS256"])
{'some': 'payload'}
Comment

PREVIOUS NEXT
Code Example
Python :: python dict remove duplicates where name are not the same 
Python :: # remove punctuation 
Python :: Python Overloading the + Operator 
Python :: numpy.sign() in Python 
Python :: python regular expression 
Python :: ipynb import 
Python :: get country from city python 
Python :: python create temp file 
Python :: check if queryset is empty django template 
Python :: Python Tkinter Button Widget 
Python :: convert generator to list python 
Python :: rename column in pandas with second row 
Python :: python convert string to int 
Python :: print environment variables windows python 
Python :: get a column of a csv python 
Python :: exclude serializer 
Python :: z score formula in pandas 
Python :: reversed function python 
Python :: global in python 
Python :: python reference parent module 
Python :: pandas separator are multiple spaces 
Python :: escape sequence in python 
Python :: python switch statement 
Python :: numpy sqrt 
Python :: python abc 
Python :: python dataframe replace in all dataframe 
Python :: vscode python multiline comment 
Python :: hover show all Y values in Bokeh 
Python :: react-native-dropdown-picker 
Python :: torch.load 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =