Open antoineleclair opened 7 years ago
@antoineleclair Hello, it’s been a while!
The above fix today caused the following:
File "/…/velruse/providers/facebook.py", line 121, in callback
access_token = r.json()['access_token']
KeyError: 'access_token'
Looking at the response body though, r.json()
gives me a dictionary of the following form:
{
'access_token': 'EA…ZD',
'token_type': 'bearer',
'expires_in': 5180555
}
Should 'bearer'
not be 'Bearer'
though? When I use the following code, oddly enough it works:
rbody = r.json()
access_token = rbody['access_token']
From their changelog:
[Oauth Access Token] Format - The response format of https://www.facebook.com/v2.3/oauth/access_token returned when you exchange a code for an access_token now return valid JSON instead of being URL encoded. The new format of this response is {"access_token": {TOKEN}, "token_type":{TYPE}, "expires_in":{TIME}}. We made this update to be compliant with section 5.1 of RFC 6749.
Otherwise the Facebook provider is now broken since they stopped supporting the old way.