[Python-modules-commits] [python-social-auth] 147/322: Cleanup imports and hmac creation, fix python3 compatibility
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Dec 24 15:13:01 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to tag v0.2.10
in repository python-social-auth.
commit 53091fcca5ef0d74b8ec234dd963f0bba1ba5145
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date: Tue Feb 24 14:48:43 2015 -0200
Cleanup imports and hmac creation, fix python3 compatibility
---
social/backends/facebook.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/social/backends/facebook.py b/social/backends/facebook.py
index eb7a494..17b5238 100644
--- a/social/backends/facebook.py
+++ b/social/backends/facebook.py
@@ -13,11 +13,6 @@ from social.backends.oauth import BaseOAuth2
from social.exceptions import AuthException, AuthCanceled, AuthUnknownError, \
AuthMissingParameter
-import hmac
-import hashlib
-
-def hmac_sha256(key, msg):
- return hmac.new(key, msg, digestmod=hashlib.sha256).hexdigest()
class FacebookOAuth2(BaseOAuth2):
"""Facebook OAuth2 authentication backend"""
@@ -54,8 +49,11 @@ class FacebookOAuth2(BaseOAuth2):
if self.setting('APPSECRET_PROOF', True):
_, secret = self.get_key_and_secret()
- params['appsecret_proof'] = hmac_sha256(secret, access_token);
-
+ params['appsecret_proof'] = hmac.new(
+ secret.encode('utf8'),
+ msg=access_token.encode('utf8'),
+ digestmod=hashlib.sha256
+ ).hexdigest()
return self.get_json(self.USER_DATA_URL, params=params)
def process_error(self, data):
--
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