[FIX] auth_oauth: login with Facebook
Configuration: - Change the scope to: user_profile,email - Change the validation url to 'https://graph.facebook.com/me' that returns more information about the user. Facebook open graph API does not send the expected 'user_id' parameter, need to use the 'id' key. Fixes #5546 Closes #7532
This commit is contained in:
parent
84dffd2dee
commit
e232221514
|
@ -14,8 +14,8 @@
|
|||
<record id="provider_facebook" model="auth.oauth.provider">
|
||||
<field name="name">Facebook Graph</field>
|
||||
<field name="auth_endpoint">https://www.facebook.com/dialog/oauth</field>
|
||||
<field name="scope"></field>
|
||||
<field name="validation_endpoint">https://graph.facebook.com/me/permissions</field>
|
||||
<field name="scope">public_profile,email</field>
|
||||
<field name="validation_endpoint">https://graph.facebook.com/me</field>
|
||||
<field name="data_endpoint"></field>
|
||||
<field name="css_class">fa fa-facebook-square</field>
|
||||
<field name="body">Log in with facebook</field>
|
||||
|
|
|
@ -101,7 +101,12 @@ class res_users(osv.Model):
|
|||
validation = self._auth_oauth_validate(cr, uid, provider, access_token)
|
||||
# required check
|
||||
if not validation.get('user_id'):
|
||||
# Workaround: facebook does not send 'user_id' in Open Graph Api
|
||||
if validation.get('id'):
|
||||
validation['user_id'] = validation['id']
|
||||
else:
|
||||
raise openerp.exceptions.AccessDenied()
|
||||
|
||||
# retrieve and sign in user
|
||||
login = self._auth_oauth_signin(cr, uid, provider, validation, params, context=context)
|
||||
if not login:
|
||||
|
|
Loading…
Reference in New Issue