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

DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode(). #37

Closed
henrywill4 opened this issue Jan 7, 2021 · 6 comments

Comments

@henrywill4
Copy link

I'm receiving this error when running the notebook.
DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode().

This is in the cell after the heading

1.1 Set up access to the training data

on this line:
52 workspace = skills_util.retrieve_workspace(workspace_id=workspace_id,
---> 53 conversation=conversation)

It appears to be some type of authentication issue.
Any ideas what this might be?

@haodeqi
Copy link
Contributor

haodeqi commented Jan 7, 2021

HI Henry, can you post the full logs. I cannot reproduce the error. Also what version is your ibm-watson and ibm-cos-sdk?

@henrywill4
Copy link
Author

henrywill4 commented Jan 7, 2021

Sure @haodeqi - I can provide logs if you tell me how to get the logs and find the versions of those two items (Sorry, I'm a newbie in that respect).

I found this interesting post about why algorithm is now required when calling jwt.decode
https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/

This documentation also mentions it
https://pyjwt.readthedocs.io/_/downloads/en/stable/pdf/

Here's the error i am receiving and it appears that site-packages\ibm_cloud_sdk_core\jwt_token_manager.py is not passing the algorithm as is now required.

`

DecodeError Traceback (most recent call last)
in
52
53 workspace = skills_util.retrieve_workspace(workspace_id=workspace_id,
---> 54 conversation=conversation)

~\assistant-dialog-skill-analysis\assistant_dialog_skill_analysis\utils\skills_util.py in retrieve_workspace(workspace_id, conversation, export_flag)
181 :return: workspace_dictionary
182 """
--> 183 ws_json = conversation.get_workspace(workspace_id, export=export_flag)
184 return ws_json.get_result()
185

C:\ProgramData\Anaconda3\lib\site-packages\ibm_watson\assistant_v1.py in get_workspace(self, workspace_id, export, include_audit, sort, **kwargs)
454 url=url,
455 headers=headers,
--> 456 params=params)
457
458 response = self.send(request)

C:\ProgramData\Anaconda3\lib\site-packages\ibm_cloud_sdk_core\base_service.py in prepare_request(self, method, url, headers, params, data, files, **kwargs)
295 request['data'] = data
296
--> 297 self.authenticator.authenticate(request)
298
299 # Next, we need to process the 'files' argument to try to fill in

C:\ProgramData\Anaconda3\lib\site-packages\ibm_cloud_sdk_core\authenticators\iam_authenticator.py in authenticate(self, req)
104 """
105 headers = req.get('headers')
--> 106 bearer_token = self.token_manager.get_token()
107 headers['Authorization'] = 'Bearer {0}'.format(bearer_token)
108

C:\ProgramData\Anaconda3\lib\site-packages\ibm_cloud_sdk_core\jwt_token_manager.py in get_token(self)
77 """
78 if self._is_token_expired():
---> 79 self.paced_request_token()
80
81 if self._token_needs_refresh():

C:\ProgramData\Anaconda3\lib\site-packages\ibm_cloud_sdk_core\jwt_token_manager.py in paced_request_token(self)
122 if not request_active:
123 token_response = self.request_token()
--> 124 self._save_token_info(token_response)
125 self.request_time = 0
126 return

C:\ProgramData\Anaconda3\lib\site-packages\ibm_cloud_sdk_core\jwt_token_manager.py in _save_token_info(self, token_response)
189
190 # The time of expiration is found by decoding the JWT access token
--> 191 decoded_response = jwt.decode(access_token, verify=False)
192 # exp is the time of expire and iat is the time of token retrieval
193 exp = decoded_response.get('exp')

C:\ProgramData\Anaconda3\lib\site-packages\jwt\api_jwt.py in decode(self, jwt, key, algorithms, options, **kwargs)
111 **kwargs,
112 ) -> Dict[str, Any]:
--> 113 decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs)
114 return decoded["payload"]
115

C:\ProgramData\Anaconda3\lib\site-packages\jwt\api_jwt.py in decode_complete(self, jwt, key, algorithms, options, **kwargs)
78 if options["verify_signature"] and not algorithms:
79 raise DecodeError(
---> 80 'It is required that you pass in a value for the "algorithms" argument when calling decode().'
81 )
82

DecodeError: It is required that you pass in a value for the "algorithms" argument when calling decode().
`

@henrywill4
Copy link
Author

@haodeqi

pip list
Package Version


aiohttp 3.7.3
alabaster 0.7.12
anaconda-client 1.7.2
anaconda-navigator 1.9.6
anaconda-project 0.8.2
asn1crypto 0.24.0
astroid 2.1.0
astropy 3.1
async-timeout 3.0.1
atomicwrites 1.2.1
attrs 18.2.0
Babel 2.6.0
backcall 0.1.0
backports.os 0.1.1
backports.shutil-get-terminal-size 1.0.0
beautifulsoup4 4.6.3
bitarray 0.8.3
bkcharts 0.2
blaze 0.11.3
bleach 3.0.2
blis 0.4.1
bokeh 1.0.2
boto 2.49.0
Bottleneck 1.2.1
bs4 0.0.1
catalogue 1.0.0
certifi 2018.11.29
cffi 1.11.5
chardet 3.0.4
Click 7.0
cloudpickle 0.6.1
clyent 1.2.2
colorama 0.4.1
comtypes 1.1.7
conda 4.5.12
conda-build 3.17.6
conda-verify 3.1.1
configparser 5.0.1
contextlib2 0.5.5
cryptography 2.4.2
cycler 0.10.0
cymem 2.0.5
Cython 0.29.2
cytoolz 0.9.0.1
dask 1.0.0
datashape 0.5.4
decorator 4.3.0
defusedxml 0.5.0
distributed 1.25.1
docutils 0.14
entrypoints 0.2.3
et-xmlfile 1.0.1
fastcache 1.0.2
filelock 3.0.10
Flask 1.0.2
Flask-Cors 3.0.7
future 0.17.1
gevent 1.3.7
glob2 0.6
greenlet 0.4.15
h5py 2.8.0
heapdict 1.0.0
html5lib 1.0.1
ibm-cloud-sdk-core 1.7.3
ibm-cos-sdk 2.7.0
ibm-cos-sdk-core 2.7.0
ibm-cos-sdk-s3transfer 2.7.0
ibm-watson 5.0.2
idna 2.8
imageio 2.4.1
imagesize 1.1.0
importlib-metadata 3.3.0
ipykernel 5.1.0
ipython 7.2.0
ipython-genutils 0.2.0
ipywidgets 7.4.2
isort 4.3.4
itsdangerous 1.1.0
jdcal 1.4
jedi 0.13.2
Jinja2 2.10
jmespath 0.10.0
joblib 1.0.0
jsonschema 2.6.0
jupyter 1.0.0
jupyter-client 5.2.4
jupyter-console 6.0.0
jupyter-core 4.4.0
jupyterlab 0.35.3
jupyterlab-server 0.2.0
keyring 17.0.0
kiwisolver 1.0.1
lazy-object-proxy 1.3.1
libarchive-c 2.8
llvmlite 0.26.0
locket 0.2.0
lxml 4.2.5
MarkupSafe 1.1.0
matplotlib 3.3.3
mccabe 0.6.1
menuinst 1.4.14
mistune 0.8.4
mkl-fft 1.0.6
mkl-random 1.0.2
more-itertools 4.3.0
mpmath 1.1.0
msgpack 0.5.6
multidict 5.1.0
multipledispatch 0.6.0
murmurhash 1.0.5
navigator-updater 0.2.1
nbconvert 5.4.0
nbformat 4.4.0
networkx 2.2
nltk 3.4
nose 1.3.7
notebook 5.7.4
numba 0.41.0
numexpr 2.6.8
numpy 1.19.5
numpydoc 0.8.0
odo 0.5.1
olefile 0.46
openpyxl 2.5.12
packaging 18.0
pandas 1.2.0
pandocfilters 1.4.2
parso 0.3.1
partd 0.3.9
path.py 11.5.0
pathlib2 2.3.3
patsy 0.5.1
pep8 1.7.1
pickleshare 0.7.5
Pillow 8.0.1
pip 18.1
pkginfo 1.4.2
plac 1.1.3
pluggy 0.8.0
ply 3.11
preshed 3.0.5
prometheus-client 0.5.0
prompt-toolkit 2.0.7
psutil 5.4.8
py 1.7.0
pycodestyle 2.4.0
pycosat 0.6.3
pycparser 2.19
pycrypto 2.6.1
pycurl 7.43.0.2
pyflakes 2.0.0
Pygments 2.3.1
PyJWT 2.0.0
pylint 2.2.2
pyodbc 4.0.25
pyOpenSSL 18.0.0
pyparsing 2.3.0
PySocks 1.6.8
pytest 4.0.2
pytest-arraydiff 0.3
pytest-astropy 0.5.0
pytest-doctestplus 0.2.0
pytest-openfiles 0.3.1
pytest-remotedata 0.3.1
python-dateutil 2.7.5
pytz 2018.7
PyWavelets 1.0.1
pywin32 223
pywinpty 0.5.5
PyYAML 3.13
pyzmq 17.1.2
QtAwesome 0.5.3
qtconsole 4.4.3
QtPy 1.5.2
requests 2.21.0
rope 0.11.0
ruamel-yaml 0.15.46
scikit-image 0.14.1
scikit-learn 0.24.0
scipy 1.6.0
seaborn 0.11.1
Send2Trash 1.5.0
setuptools 40.6.3
simplegeneric 0.8.1
singledispatch 3.4.0.3
six 1.12.0
snowballstemmer 1.2.1
sortedcollections 1.0.1
sortedcontainers 2.1.0
spacy 2.3.2
Sphinx 1.8.2
sphinxcontrib-websupport 1.1.0
spyder 3.3.2
spyder-kernels 0.3.0
SQLAlchemy 1.2.15
squarify 0.4.3
srsly 1.0.5
statsmodels 0.9.0
sympy 1.3
tables 3.4.4
tabulate 0.8.7
tblib 1.3.2
terminado 0.8.1
testpath 0.4.2
thinc 7.4.1
threadpoolctl 2.1.0
toolz 0.9.0
tornado 5.1.1
tqdm 4.55.1
traitlets 4.3.2
typing-extensions 3.7.4.3
unicodecsv 0.14.1
urllib3 1.24.1
wasabi 0.8.0
wcwidth 0.1.7
webencodings 0.5.1
websocket-client 0.48.0
Werkzeug 0.14.1
wheel 0.32.3
widgetsnbextension 3.4.2
win-inet-pton 1.0.1
win-unicode-console 0.5
wincertstore 0.2
wrapt 1.10.11
xlrd 1.2.0
XlsxWriter 1.1.2
xlwings 0.15.1
xlwt 1.3.0
yarl 1.6.3
zict 0.1.3
zipp 3.4.0

@henrywill4
Copy link
Author

henrywill4 commented Jan 8, 2021 via email

@haodeqi
Copy link
Contributor

haodeqi commented Jan 11, 2021

@henrywill4 , I think this is a known issue of PyJWT. You should try downgrade the package by pip install PyJWT==1.7.1 and let me know if that resolve your issue.

@henrywill4
Copy link
Author

henrywill4 commented Jan 12, 2021

@haodeqi - Thanks so much. This worked! I thought this was the issue. I saw a similar suggestion elsewhere for the same issue. They also recommended to downgrade. We can close this now. I do wonder when you believe this will be updated to accommodate the new version of PyJWT though.

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

No branches or pull requests

2 participants