I got Twitter and Google login with Django all-auth. Having issues with Facebook now. Tried every single combination between localhost/127.0.0.1/etc (also went extreme routes by changing my hosts to local.domain.com - even got an SSL thing going as Facebook apparently blocks http access (since March 2018).
Got this far... now I get this error Can anyone lead me into the right direction? I'm about to pull my hair out.
KeyError at /accounts/facebook/login/token/ 'access_token' Request Method: POST Request
URL: https://localhost:8000/accounts/facebook/login/token/ Django Version: 2.0.3 Exception Type: KeyError Exception Value:
'access_token'
{'error': {'code': 5,
'fbtrace_id': 'Bs4PHOvc+rZ',
'message': "This IP can't make requests for that application.",
'type': 'OAuthException'}}
Addition details:
http://localhost:8000/accounts/facebook/login/callback
SOCIALACCOUNT_PROVIDERS = {
'facebook': {
'METHOD': 'js_sdk',
'SCOPE': ['email', 'public_profile', 'user_friends'],
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
'INIT_PARAMS': {'cookie': True},
'FIELDS': [
'id',
'email',
'name',
'first_name',
'last_name',
'verified',
'locale',
'timezone',
'link',
'gender',
'updated_time',
],
'LOCALE_FUNC': lambda request: 'en_GB',
'EXCHANGE_TOKEN': True,
'VERIFIED_EMAIL': False,
'VERSION': 'v2.5',
}
}
Django 1.4.15, django-allauth 0.18.0, Facebook upgrade API v2.8
Since Mars 2018, Facebook sets "Use Strict Mode for Redirect URls" YES by default. My problem was in the Facebook App configuration, not in django-allauth.
Working again App settings:
Settings Basic
- App Domains: "AnySite.com"
- Privacy policy URL: "https://AnySite.com/myprivacy/"
- Website: "https://AnySite.com/"
Settings Advanced
- Server IP Whitelist: let it blank
- Domain Manager: let it blank
Facebook login Settings
Yes Client OAuth Login
Yes Web OAuth Login
Yes (new: forced) Use strict Mode for redicect URLs
Yes Embeded Browser OAuth Login
Yes Enforce HTTPS
Valid OAuth Redirect URLs: "https://AnySite.com/accounts/facebook/login/callback/" (mandatory)
Hope it helps.