[Python-modules-commits] [python-social-auth] 28/131: Storing token_type in extra_data field when using OAuth 2.0
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Dec 24 15:16:57 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to tag v0.2.20
in repository python-social-auth.
commit 8b00dd1edb27b7918ab50bedb3b2d878e5941dc8
Author: Clinton Blackburn <clinton.blackburn at gmail.com>
Date: Sat Apr 23 18:30:25 2016 -0400
Storing token_type in extra_data field when using OAuth 2.0
This value is useful for authentication servers that may provide multiple types of tokens.
---
social/backends/oauth.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/social/backends/oauth.py b/social/backends/oauth.py
index b2210ec..6b3b6a3 100644
--- a/social/backends/oauth.py
+++ b/social/backends/oauth.py
@@ -357,6 +357,13 @@ class BaseOAuth2(OAuthAuth):
return {'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'}
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
+ """Return access_token, token_type, and extra defined names to store in
+ extra_data field"""
+ data = super(BaseOAuth2, self).extra_data(user, uid, response, details=details, *args, **kwargs)
+ data['token_type'] = response.get('token_type') or kwargs.get('token_type')
+ return data
+
def request_access_token(self, *args, **kwargs):
return self.get_json(*args, **kwargs)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git
More information about the Python-modules-commits
mailing list