Closed wellsoliver closed 3 months ago
Hi @wellsoliver ,
installing a pyjwt
is not a hacky way, but it is required for JWT Auth to work correctly. In our docs we have a section about using JWT (it can be found here). It is stated that to use JWT Auth you should use
pip install box-sdk-gen[jwt]
command. That installs all required dependencies for jwt auth including pyjwt - jwt_requires = ['pyjwt>=1.7.0', 'cryptography>=3']
(part of setup.py file).
If you use box-sdk-gen in requirements.txt file, just use box-sdk-gen[jwt]
there to fetch all requirements.
Installing this https://pypi.org/project/jwt/ library is not necessary at all. We don't use that library in this project. I'm closing this issue as this is done by design, but feel free to reopen it if you have any questions. Best, @lukaszsocha2
Thanks for the detail. Not to reopen, but in case anyone stumbles across this and uses poetry instead of a requirements file, running poetry add pyjwt cryptography
helps solve this issue, at the time of writing this with pyjwt
2.8.0 and cryptography
43.0.0 -- no need for jwt
itself, as stated. Might be useful to update the box docs with a poetry section re: JWT...
Using JWT auth in the following fashion, with
jwt
1.3.1 installed:Auth works, but calling
client.search.search_for_content(...)
throws a jwt exception:This can be resolved in a hacky way by also installing
pyjwt
and I say hacky because both libraries insall into thejwt
directory in site-packages, and both contain three files of the same name includingjwt.py
so it's a matter of making surepyjwt
is installed afterjwt
.My full search is a date range which looks like:
Not sure if there's another way of doing what I am doing, seems like standard (and broken?) API usage when using JWT.