[Answered ]-Rauth: the JSON object must be str, not 'bytes'

2πŸ‘

βœ…

I still think there should be something more straight forward or a bug fix to this, but here’s my own workaround:

def oauth_decode(data):
    import json

    new_data = data.decode("utf-8", "strict")

    return json.loads(new_data)
...
session = sso.get_auth_session(data=data, decoder=oauth_decode)

The problem is that get_auth_session decodes the byte stream from the response to UTF-8 by default. If you specify a new decoder, you override that. So I guess we need both here (UTF-8 + JSON).

Leave a comment