Skip to content

Commit d0a1ea5

Browse files
committed
pyJwt
1 parent d81ee1f commit d0a1ea5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

libraries/pyjwt/run.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# $ pip install PyJWT
2+
# https://github.com/jpadilla/pyjwt/
3+
4+
import jwt
5+
6+
encodedJWT = jwt.encode({"Header": {
7+
"alg": "HS256",
8+
"typ": "JWT"
9+
}, "payload": {
10+
"sub": "1234567890",
11+
"name": "John Doe",
12+
"iat": 1516239022
13+
},"footer": {"line":"item"}}, "secret", algorithm="HS256")
14+
print(encodedJWT)
15+
16+
decodedJWT = jwt.decode(encodedJWT, "secret", algorithms=["HS256"])
17+
print(decodedJWT)

0 commit comments

Comments
 (0)