JWT Oath using python

Answered
New post

Comments

7 comments

  • jmoldow_box

    The square brackets indicates installing an "extra".

     

    In our setup.py (https://github.com/box/box-python-sdk/blob/master/setup.py) file, you'll see this:

     

     

    extra_requires = defaultdict(list)
    extra_requires.update({'jwt': jwt_requires, 'redis': redis_requires, 'all': jwt_requires + redis_requires})
    
    setup(
        ...
        extras_require=extra_requires,
        ...
    )

     

    The 'jwt' dependencies aren't required to use the SDK, but they are required to use the JWT features of the SDK. pip install boxsdk[jwt] says to install boxsdk, its dependencies, AND the extra 'jwt' dependencies.

     

    I'm not sure why this isn't working for you, but here's three ideas:

     

    In case your terminal is trying to do something special with the square brackets, try surrounding the last part in quotes: pip install "boxsdk[jwt]"

     

    Or perhaps your versions of wheel, setuptools, and pip are too old. Inside your virtualenv, run

    python -m pip install -U wheel
    python -m pip install -U setuptools
    python -m pip install -U pip

    Finally, if it still doesn't work, you can install the dependencies by hand: pip install boxsdk 'pyjwt>=1.3.0' 'cryptography>=0.9.2'

     

    And if installing cryptography gives you problems, see https://cryptography.io/en/latest/installation/ .

    0
    Comment actions Permalink
  • jbower1

    Thanks - I knew there was an easy solution.  Quotes solved it.  

     

     

    0
    Comment actions Permalink
  • TInkster

    Hi - may I ask where those quotes went? 

     

    I just ran into this errror, too, trying to wrap my head around JWTAuth and basically following what I found here in this thread.

     

     

    Cheers,

    Andrej

    0
    Comment actions Permalink
  • PatrickH-cimba

    I ran into the same issue and it ended up being the cryptography install was missing. I ran this install  

    sudo yum install gcc libffi-devel python-devel openssl-devel

    then ran this:

    sudo pip install "boxsdk[jwt]"

    and it worked.  

    0
    Comment actions Permalink
  • mmorleydesign

    After these instructions I get a:

    ValueError: Could not unserialize key data.

     I am running Python 2.7

    0
    Comment actions Permalink
  • rsabi

    Try my answer found here:

     

    https://community.box.com/t5/Platform-and-Development-Forum/Authentication-Using-JWT-in-Python-quot-Nonetype-quot-issue/m-p/55531/highlight/false#M4559

     

    you may have the wrong JWT package if you are using python 2.7

    0
    Comment actions Permalink
  • Rommel Silva

    Any thoughts on getting this to work in 2020? 

     

    0
    Comment actions Permalink

Please sign in to leave a comment.