]> git.parisson.com Git - django-social-auth.git/commitdiff
Use primary email as user ID for Google OpenId. Closes gh-117
authorMatías Aguirre <matiasaguirre@gmail.com>
Sun, 14 Aug 2011 06:19:55 +0000 (03:19 -0300)
committerMatías Aguirre <matiasaguirre@gmail.com>
Sun, 14 Aug 2011 06:19:55 +0000 (03:19 -0300)
social_auth/backends/google.py

index efc4a3d1c31a4711f2c28b4e7b44898a249bfb1c..955012119834f3ed5019f4819f203e61fe84b6d4 100644 (file)
@@ -72,6 +72,11 @@ class GoogleBackend(OpenIDBackend):
     """Google OpenID authentication backend"""
     name = 'google'
 
+    def get_user_id(self, details, response):
+        """Return user unique id provided by service. For google user email
+        is unique enought to flag a single user. Email comes from schema:
+        http://axschema.org/contact/email"""
+        return details['email']
 
 # Auth classes
 class GoogleAuth(OpenIdAuth):