Auth0 Home Blog Docs

Can we generate jwt token with java and can it be decoded with python.

jwt
java
python

#1

I am trying to generate jwt token with java and wanted to decode it in python will it possible to do this in both ways. I am getting the signature error while doing this. Can you please provide the possibility of doing this.


#2

You can validate JWT’s using any supporting library - You can see a list on https://jwt.io/. Note: Generating your own JWT is not recommended.


#3

@prashant

I am trying to create a JWT token with java library by using my own payload and secret and I am able to decode it with java, but when I try to decode it with python I am getting below error.

here is the error that I am getting while decoding from python.
jwt.exceptions.DecodeError: Signature verification failed

eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJsbHRcIjoxNDk2NDkwNTA4MjI1LFwibUlkXCI6XCIxMDA1OTU2NEFERjc5NDNFNjgxN0IyM1wifSJ9.Z3woJ3coqGK6DFHqF4QaL53JcKlNiyGQi4LRWInyC9M

test123 is the secret which I have used


#4

@prashant

I am trying to create a JWT token with java library by using my own payload and secret and I am able to decode it with java, but when I try to decode it with python I am getting below error.

here is the error that I am getting while decoding from python.
jwt.exceptions.DecodeError: Signature verification failed

eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJsbHRcIjoxNDk2NDkwNTA4MjI1LFwibUlkXCI6XCIxMDA1OTU2NEFERjc5NDNFNjgxN0IyM1wifSJ9.Z3woJ3coqGK6DFHqF4QaL53JcKlNiyGQi4LRWInyC9M

test123 is the secret which I have used


#5

By any chance, are you using the library for this issue?
https://github.com/jpadilla/pyjwt/issues/198

I would suggest testing with another library. As mentioned in the issue, a similar issue was resolved using python-jose.


#6

I am facing similar issue but in node js.
I am trying to verify the jwt token in node js which is generated using java. but it gives JsonWebTokenError: invalid signature error while verifying it.

Thanks,
Pravin


#7

I am facing similar issue but in node js.
I am trying to verify the jwt token in node js which is generated using java. but it gives JsonWebTokenError: invalid signature error while verifying it.

Thanks,
Pravin


#8