Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

In FacebookGraphMixin, explicitly request required user fields.

This is necessary due to a recent change in the facebook API.

Closes #227.
  • Loading branch information...
commit 7d304034a87243e8621933fef1642a54a3c90916 1 parent cc2363a
@bdarnell bdarnell authored
Showing with 8 additions and 10 deletions.
  1. +8 −10 tornado/auth.py
View
18 tornado/auth.py
@@ -955,15 +955,16 @@ def _on_login(self, user):
"client_secret": client_secret,
}
- if extra_fields and not isinstance(extra_fields, (set, frozenset)):
- extra_fields = set(extra_fields)
+ fields = set(['id', 'name', 'first_name', 'last_name',
+ 'locale', 'picture', 'link'])
+ if extra_fields: fields.update(extra_fields)
http.fetch(self._oauth_request_token_url(**args),
self.async_callback(self._on_access_token, redirect_uri, client_id,
- client_secret, callback, extra_fields))
+ client_secret, callback, fields))
def _on_access_token(self, redirect_uri, client_id, client_secret,
- callback, extra_fields, response):
+ callback, fields, response):
if response.error:
logging.warning('Facebook auth error: %s' % str(response))
callback(None)
@@ -977,20 +978,17 @@ def _on_access_token(self, redirect_uri, client_id, client_secret,
self.facebook_request(
path="/me",
callback=self.async_callback(
- self._on_get_user_info, callback, session, extra_fields),
+ self._on_get_user_info, callback, session, fields),
access_token=session["access_token"],
- fields="picture" # This one's exceptional in that it appends to fields returned
+ fields=",".join(fields)
)
- def _on_get_user_info(self, callback, session, extra_fields, user):
+ def _on_get_user_info(self, callback, session, fields, user):
if user is None:
callback(None)
return
- fields = set(['id', 'name', 'first_name', 'last_name', 'locale', 'picture', 'link'])
- if extra_fields: fields.update(extra_fields)
-
fieldmap = {}
for field in fields:
fieldmap[field] = user.get(field)

0 comments on commit 7d30403

Please sign in to comment.
Something went wrong with that request. Please try again.