Comments (2)
You can decode a JWS signed by a symmetric key in the same way to decode one signed by a asymmetric key like below.
import jwt
jwk = {"kty": "oct", "k": "# YOUR SYMMETRIC JWK KEY #"}
key = jwt.jwk_from_dict(jwk)
instance = jwt.JWT()
instance.decode('JWT PAYLOAD', key)
You can also refer to the working test case at
python-jwt/jwt/tests/test_jwt.py
Lines 26 to 50 in 6e45f9d
from python-jwt.
Or you can also instantiate symmetric JWK directly as below.
import jwt
from jwt.jwk import OctetJWK
key = OctetJWK(b'SYMMETRIC KEY')
instance = jwt.JWT()
instance.decode('JWT PAYLOAD', key)
from python-jwt.
Related Issues (20)
- support for cryptography 2 HOT 1
- python-jwt will install in python 2 under Mac OS HOT 5
- AttributeError: 'dict' object has no attribute '_jws' HOT 12
- Can't perform makemigrations Jango when using JWT HOT 2
- return header with payload when decoding token HOT 1
- cryptography install fails
- Seems client can pass any token with none algo HOT 3
- AbstractJWKBase Should be an ABC class HOT 2
- Invalid Syntax: alg:str HOT 1
- how to use jwks?
- Unable to import under Python 3.8 HOT 2
- cryptography <= 2.9.2 CVE HOT 2
- Conflict with PyJWT HOT 1
- require newer cryptography package HOT 1
- Relax or remove upper bound for cryptography HOT 1
- Fix for python 3.10 (collections interface) HOT 1
- TypeError: _EllipticCurvePublicKey.verify() takes 4 positional arguments but 5 were given HOT 1
- AttributeError: module 'jwt' has no attribute 'encode'
- Simple way to enable none algorithm for unit testing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-jwt.