WebexPythonSDK icon indicating copy to clipboard operation
WebexPythonSDK copied to clipboard

GuestIssuer jwt_token.decode('utf-8') redundant?

Open JardaMartan opened this issue 3 years ago • 4 comments

guest_issuer.create() fails with

site-packages/webexteamssdk/api/guest_issuer.py", line 124, in create
    "Authorization": "Bearer " + jwt_token.decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'

I believe this happens because jwt.encode() returns plain ASCII string which doesn't provide decode() method. My environment is Python3.9. "Authorization": "Bearer " + jwt_token works fine.

JardaMartan avatar Jun 10 '21 20:06 JardaMartan

@JardaMartan could you specify the version of the dependencies (especially the jwt library) that you have installed? There used to be the reverse issue where a binary was returned and thus decode was necessary.

sQu4rks avatar Jun 17 '21 12:06 sQu4rks

I'm using PyJWT 2.1.0 imported by the installation of webexteamssdk package. No other installs. Python 3.9.

(venv) JMARTAN-M-N0F8:guest jmartan$ pip install webexteamssdk
Collecting webexteamssdk
  Downloading webexteamssdk-1.6-py3-none-any.whl (113 kB)
     |████████████████████████████████| 113 kB 3.4 MB/s 
Collecting PyJWT
  Downloading PyJWT-2.1.0-py3-none-any.whl (16 kB)

----
(venv) JMARTAN-M-N0F8:guest jmartan$ pip freeze | grep -i jwt
PyJWT==2.1.0

JardaMartan avatar Jun 17 '21 15:06 JardaMartan

thanks. I'll try and reproduce your error.

sQu4rks avatar Jun 18 '21 06:06 sQu4rks

Ran into the same error using PyJWT. Apparently, it already provides the jwt token as a string, not a binary. The quick fix was to roll back to PyJWT==1.7.1. I suppose something could be done to check version of the dependencies of this package.

pedrogk avatar Aug 29 '21 04:08 pedrogk