Skip to content
Snippets Groups Projects
Commit 16bfda99 authored by Alex Kashuba's avatar Alex Kashuba
Browse files

Test PyJWT

parent aa3bcd7d
No related branches found
No related tags found
No related merge requests found
import jwt
from pytest import fixture, mark
from pprint import pprint
@fixture
def token():
return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTc0NDI5OTExMywiaWF0IjoxNzQ0MjEyNzEzLCJqdGkiOiI4MmVlZWY3MTVmZTg0MmMxOWFjYjA3NWNhYzUyOGY4ZCIsInVzZXJfaWQiOjZ9.rWPPNQ8D38t7qT3-ZQbfqkijNKS1_JuCyNkm7zOXZb4"
def test_basic_jwt(token):
options = {
"require": ["exp", "iat", "jti", "token_type", "user_id"],
"verify_signature": False,
"verify_exp": True,
}
decoded_jwt = jwt.decode(jwt=token, algorithms="HS256", options=options)
pprint(decoded_jwt)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment