Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request_jwt_user_token error that can't decode a string #94

Open
binyominc opened this issue Dec 22, 2020 · 9 comments
Open

request_jwt_user_token error that can't decode a string #94

binyominc opened this issue Dec 22, 2020 · 9 comments

Comments

@binyominc
Copy link

binyominc commented Dec 22, 2020

function request_jwt_user_token

following line gives an error
token = jwt.encode(payload=claim, key=private_key_bytes, algorithm='RS256').decode("utf-8")

"stackTrace": [
"Traceback (most recent call last):\n",
" my_file_that_uses_the_docusign_api line something",
" File "/var/task/docusign_esign/client/api_client.py", line 689, in request_jwt_user_token\n token = jwt.encode(payload=claim, key=private_key_bytes, algorithm='RS256').decode("utf-8")\n",
"AttributeError: 'str' object has no attribute 'decode'\n"

@jazzdev
Copy link

jazzdev commented Dec 22, 2020

SO says in Python 3 just drop the .decode("utf-8") part.

@binyominc
Copy link
Author

binyominc commented Dec 23, 2020

@jazzdev I think you're 100% right. The problem is that this is in the api_client of this library and I'm installing it with pip. I could technically pull down the library with git and just put it in my project and take out that line, but as it is in this repo, it's imcompatible with python3.

@binyominc
Copy link
Author

Looks like there was a breaking change to pyjwt jpadilla/pyjwt@4770745
see specifically line 82. It no longer is compatible with python 2, which means that the comment @jazzdev made will end up being an issue for anyone who uses this library.

@eduardo-marcolino
Copy link

Adding PyJWT==1.7.1 to requirements.txt fix it for me.

@binyominc
Copy link
Author

binyominc commented Dec 28, 2020

@eduardo-marcolino makes sense. Thanks! I would suggest just to code the specific version of this library too, in case the newer versions of this library are assuming the newer version of PyJWT

@harsharahul
Copy link
Contributor

Hello,
The new release of eSign sdk, locks the version to be less than 2.0 for PyJWT package to avoid breaking changes. This should fix issue unless a higher version of the package is already installed or cached in system.

Meanwhile, we are looking to update to a more suitable JWT library for all versions possible.

Thank you all for your help. Appreciate the community's help all around.

@gauravdixit007
Copy link

gauravdixit007 commented Mar 26, 2021

@harsharahul Hi,

Thanks for looking into this. Any expected date for the new release with support for PyJWT 2.0
I would be happy to create a PR if you don't have the bandwidth. Thanks !!!

@Seluj78
Copy link

Seluj78 commented Dec 6, 2021

Hi, any news for a PyJWT update ? We're using 2.3 in production and the fact that we have to rollback to 1.7 is a pain

@aureliendebord
Copy link

Hi, any news for a PyJWT update ? We're using 2.3 in production and the fact that we have to rollback to 1.7 is a pain

Check this comment : #135 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants