Questions tagged [pyjwt]

Anything related to PyJWT library. It is JSON Web Token implementation in Python.

PyJWT is a Python library for encoding and decododing JSON Web Tokens (JWT). JWT is a compact, URL-safe means of representing claims to be transferred between two parties. It is intended for space constrained environments such as HTTP Authorization headers and URI query parameters. It is defined in industry-standard RFC 7519.

Learn more about it on PyJWT site

106 questions
1
vote
2 answers

Convert JWT token created by Java JWT in python

I have received a JWT token created by a java program using jjwt module. Now, when I try to verify the token using pyjwt, it throws exception. import jwt…
Palaz
  • 13
  • 1
  • 4
1
vote
1 answer

"ImportError: No module named 'jwt'" in Jupyter

I am trying to import jwt (JSON Web Token) into Python. Following this I have installed the package. The package also seem to import in the terminal python environment. >pip install PyJWT >pip freeze >PyJWT==1.4.2 >which…
Feyzi Bagirov
  • 1,292
  • 4
  • 28
  • 46
1
vote
1 answer

How can I externally verify a JWT token that has been signed with an RSA private key

I have a JWT token from AWS Cognito. The token is obtained via a call to getOpenIdTokenForDeveloperIdentity and I'm using the flow for AWS Cognito Developer Authenticated identity The token is hashed with SHA512 and signed with Amazons RSA private…
1
vote
2 answers

Python JWT and RSA

I would like to learn about creating JWT using RSA public and private key. I am a beginner to learn securing my services. I am using pyjwt right now. I got something error with my testing, here it is: SAMPLEKEY: privatekey = """-----BEGIN RSA…
Adityo Setyonugroho
  • 877
  • 1
  • 11
  • 29
1
vote
1 answer

Invalid JWT with pyjwt for Google Server to Server Applications

After failing to authenticate for Google Server to Server Applications using Python Oauthlib, I am now trying to generate directly the jwt with pyjwt then test it with curl as stated in Google documentation, but it does not work either since I now…
Antoine Brunel
  • 1,065
  • 2
  • 14
  • 30
0
votes
1 answer

Flask not detecting static files when I use web token in route function

I am trying to confirm user email using pyjwt. So basically, when a new user registers, the user receives a confirmation email containing a link, and the user clicks the link to confirm the email. If the web token has expired, the user is asked to…
0
votes
1 answer

PyJWT encode raise "Could not deserialize key data."

I use this code before and it was OK, but after months it does not work. This code suggested by pyjwt documentation without any changes. I am using XUBUNTU and dockerized my project. import jwt SEC = "SECRET" token = jwt.encode( {'name': ' ',…
CC7052
  • 563
  • 5
  • 16
0
votes
1 answer

Sending foreign key as argument resulting in This Field is Required Error

I am trying to create an app where Users can login and create tasks. The code for my django app is hosted here I am using JWT authentication and drf-yasg to generate swagger. So the TaskSerializer takes 3 arguments taskname which is a…
Echchama Nayak
  • 971
  • 3
  • 23
  • 44
0
votes
0 answers

How to resolve 'str' object has no attribute 'decode' djangorestframework_simplejwt

I Depolying my django project to heroku but i am stuck, When i send request to JWT login it throws 'str' object has no attribute 'decode' , i have researched , came to know that PyJWT version is creating issue, my PyJWT version is 2.0.0, however…
0
votes
1 answer

'install_requires' must be a string or list of strings containing valid project/version requirement specifiers

Getting error 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers when installing a package with pip. The package is an internal package but seems to error when installing one of the…
eia92
  • 81
  • 2
  • 12
0
votes
1 answer

AWS Lambda works but Lambda@Edge throws error

I have written a python lambda to redirect unauthorized users to Cognito. The lambda works when I run a test event in the lambda console, but when I try to hit the CloudFront distribution, I get the following error: [ERROR]…
Danny Ellis Jr.
  • 1,674
  • 2
  • 23
  • 38
0
votes
1 answer

JWT decode requires audience #870

I tried to use the documentation found in here: https://pyjwt.readthedocs.io/en/latest/usage.html#retrieve-rsa-signing-keys-from-a-jwks-endpoint related to the validation of a JWT token using JWKS but it was not working for me using Keycloak…
ddtxra
  • 35
  • 5
0
votes
0 answers

Parse a JWT Token issued by a Java application, inside a python script

I have a Java Spring boot API that a user logs in and is issued a JWT token ( i cant change this code). I have a new python API that needs to parse the JWT to verify its been authenticated. Java Code import io.jsonwebtoken.Jwts; private String…
Parker Dell
  • 472
  • 4
  • 11
0
votes
2 answers

'import jwt' not working in Django views.py though I have PyJwt installed

I'm working with Django and trying to generate jwt tokens in views.py and displaying it in html page. import jwt is throwing No module found error in views.py even though I have PyJwt installed already inside the virtual environment and it is…
madhu mitha
  • 3
  • 1
  • 5
0
votes
1 answer

Using the EdDSA algorithm with PyJWT

I am trying to use the EdDSA algorithm for encoding but I keep getting the below error. Any ideas as to what I am doing wrong? EllipticCurvePrivateKey = "-----BEGIN PRIVATE KEY-----\[HIDDEN]\n-----END PRIVATE KEY-----" encoded = jwt.encode({"some":…
Mukai
  • 15
  • 2