]> git.parisson.com Git - django-social-auth.git/commitdiff
Define setting to pass extra arguments to facebook.com/me. Closes #301
authorMatías Aguirre <matiasaguirre@gmail.com>
Thu, 29 Mar 2012 20:47:23 +0000 (17:47 -0300)
committerMatías Aguirre <matiasaguirre@gmail.com>
Thu, 29 Mar 2012 20:47:23 +0000 (17:47 -0300)
README.rst
doc/backends/facebook.rst
social_auth/backends/facebook.py

index 386575649032fe153ee3a7fc7e345df7ba49dfe6..9e14b063b1106775abc6b4231f8c7787d97e7a85 100644 (file)
@@ -679,6 +679,11 @@ at `Facebook development resources`_:
 
      FACEBOOK_EXTENDED_PERMISSIONS = [...]
 
+- Define ``FACEBOOK_PROFILE_EXTRA_PARAMS`` to pass extra parameters to
+  https://graph.facebook.com/me when gathering the user profile data, like::
+
+    FACEBOOK_PROFILE_EXTRA_PARAMS = {'locale': 'ru_RU'}
+
 If you define a redirect URL in Facebook setup page, be sure to not define
 http://127.0.0.1:8000 or http://localhost:8000 because it won't work when
 testing. Instead I define http://myapp.com and setup a mapping on /etc/hosts
index 49df8866ad94bbc4b3057fb6becdd49f014bd20f..94de2994ee4733fd5c78332bf6109d8e5542957f 100644 (file)
@@ -16,6 +16,11 @@ at `Facebook development resources`_:
 
      FACEBOOK_EXTENDED_PERMISSIONS = [...]
 
+- Define ``FACEBOOK_PROFILE_EXTRA_PARAMS`` to pass extra parameters to
+  https://graph.facebook.com/me when gathering the user profile data, like::
+
+    FACEBOOK_PROFILE_EXTRA_PARAMS = {'locale': 'ru_RU'}
+
 If you define a redirect URL in Facebook setup page, be sure to not define
 http://127.0.0.1:8000 or http://localhost:8000 because it won't work when
 testing. Instead I define http://myapp.com and setup a mapping on /etc/hosts
index 9943e47057f1c4f154ded2ebcec5668b0fa7a028..0669340503c010b253133d081119aee20d16e679 100644 (file)
@@ -62,7 +62,9 @@ class FacebookAuth(BaseOAuth2):
     def user_data(self, access_token):
         """Loads user data from service"""
         data = None
-        url = FACEBOOK_ME + urlencode({'access_token': access_token})
+        params = setting('FACEBOOK_PROFILE_EXTRA_PARAMS', {})
+        params['access_token'] = access_token
+        url = FACEBOOK_ME + urlencode(params)
 
         try:
             data = simplejson.load(urlopen(url))