From: Dayne Jones Date: Thu, 30 Mar 2017 01:43:07 +0000 (-0400) Subject: auth: Facebook now returns auth tokens in json instead of url-encoded X-Git-Tag: v4.5.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28287ea88ddd2d407dbc1584b156a8db4578292c;p=thirdparty%2Ftornado.git auth: Facebook now returns auth tokens in json instead of url-encoded Fixes #1992 --- diff --git a/tornado/auth.py b/tornado/auth.py index d71d56a66..554db5926 100644 --- a/tornado/auth.py +++ b/tornado/auth.py @@ -978,9 +978,9 @@ class FacebookGraphMixin(OAuth2Mixin): future.set_exception(AuthError('Facebook auth error: %s' % str(response))) return - args = urlparse.parse_qs(escape.native_str(response.body)) + args = escape.json_decode(response.body) session = { - "access_token": args["access_token"][-1], + "access_token": args.get("access_token"), "expires": args.get("expires") } diff --git a/tornado/test/auth_test.py b/tornado/test/auth_test.py index d18b7b971..14dd2f625 100644 --- a/tornado/test/auth_test.py +++ b/tornado/test/auth_test.py @@ -149,7 +149,7 @@ class FacebookClientLoginHandler(RequestHandler, FacebookGraphMixin): class FacebookServerAccessTokenHandler(RequestHandler): def get(self): - self.write('access_token=asdf') + self.write(dict(access_token="asdf")) class FacebookServerMeHandler(RequestHandler):