Open leonardopessoa opened 7 years ago
I still think there should be something more straight forward or even a bug fix to this, but here's my own workaround:
def oauth_decode(data):
import son
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).
Trying to implement a OAuth2 authentication on Django 1.10 + Python 3, I'm getting this error:
If i remove the decoder=json.loads, I get the following error:
Here is my method:
The view is accessed the first time to redirect to the authorize URL (no
GET['code']
). Next, it's accessed again (with theGET['code']
) to handle the authorization code and authenticate.Feel like there should be a mix of both solutions (encoding UTF-8 + json).