Skip to content

Error 'str' object has no attribute 'decode' from exchangeJWTforBearerToken #4

@abidawson

Description

@abidawson

I get this error when I try to run exchangeJWTforBearerToken:

 Error in py_call_impl(callable, dots$args, dots$keywords) : 
  AttributeError: 'str' object has no attribute 'decode' 

I traced this back to the version of pyJWT I'm using (2.0.1) - I don't get this error if I downgrade to version 1.7.1 of that package. However, that's not possible for me because pyjwt 1.7.1 isn't compatible with the version of python I'm using.

It looks like if we remove line 69 (the jwt.decode line below) of ExchangeJWT.py, I can run the file and retrieve the Bearer Token successfully:

    # create JSON Web Token, signing it with the private key.
    jwt_token = jwt.encode(payload, priv_key, algorithm='RS256')
        
    # decode bytes into string
    #jwt_token = jwt.decode(jwt_token, priv_key, algorithms=['RS256'])

Would it work to have this package require pyJWT 2.0.0 or higher (jpadilla/pyjwt#587) and make that change to ExchangeJWT.py?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions