Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Make facebook backend compatible with the latest api

Adam Bogdał2fc112c05518
diff --git a/saleor/registration/utils.py b/saleor/registration/utils.py
index 761335da0a..0c17452cee 100644
--- a/saleor/registration/utils.py
+++ b/saleor/registration/utils.py
@@ -171,7 +171,7 @@ class FacebookClient(OAuth2Client):
auth_uri = 'https://www.facebook.com/dialog/oauth'
token_uri = 'https://graph.facebook.com/oauth/access_token'
- user_info_uri = 'https://graph.facebook.com/me'
+ user_info_uri = 'https://graph.facebook.com/me?fields=name,email,verified'
scope = ','.join(['email'])
@@ -183,10 +183,11 @@ class FacebookClient(OAuth2Client):
def get_user_info(self):
response = super(FacebookClient, self).get_user_info()
- if response.get('verified'):
- return response
- else:
+ if not response.get('verified'):
raise ValueError('Facebook account not verified.')
+ if not response.get('email'):
+ raise ValueError('Access to your email address is required.')
+ return response
def extract_error_from_response(self, response_content):
return response_content['error']['message']