diff --git a/social_auth/backends.py b/social_auth/backends.py index 4f823fa10..0ff6e238f 100644 --- a/social_auth/backends.py +++ b/social_auth/backends.py @@ -59,7 +59,17 @@ def authenticate(self, *args, **kwargs): else: user = social_user.user + # Update the user account data. self.update_user_details(user, response, details, new_user=new_user) + + # Update the extra_data storage, unless disabled by setting. + extra_data = '' if not getattr(settings, 'SOCIAL_AUTH_EXTRA_DATA', + True) \ + else self.extra_data(user, uid, response, details) + if extra_data: + social_user.extra_data = extra_data + social_user.save() + return user def username(self, details): @@ -94,12 +104,8 @@ def get_random_username(): def associate_auth(self, user, uid, response, details): """Associate a Social Auth with an user account.""" - extra_data = '' if not getattr(settings, 'SOCIAL_AUTH_EXTRA_DATA', - False) \ - else self.extra_data(user, uid, response, details) return UserSocialAuth.objects.create(user=user, uid=uid, - provider=self.name, - extra_data=extra_data) + provider=self.name) def extra_data(self, user, uid, response, details): """Return default blank user extra data""" diff --git a/social_auth/conf.py b/social_auth/conf.py index 84f0423e7..3fcee41eb 100644 --- a/social_auth/conf.py +++ b/social_auth/conf.py @@ -3,7 +3,9 @@ TWITTER_SERVER = 'api.twitter.com' TWITTER_REQUEST_TOKEN_URL = 'https://%s/oauth/request_token' % TWITTER_SERVER TWITTER_ACCESS_TOKEN_URL = 'https://%s/oauth/access_token' % TWITTER_SERVER -TWITTER_AUTHORIZATION_URL = 'http://%s/oauth/authorize' % TWITTER_SERVER +# Note: oauth/authorize forces the user to authorize every time. +# oauth/authenticate uses their previous selection, barring revocation. +TWITTER_AUTHORIZATION_URL = 'http://%s/oauth/authenticate' % TWITTER_SERVER TWITTER_CHECK_AUTH = 'https://twitter.com/account/verify_credentials.json' # Facebook configuration