[Django]-Django 2.0 allauth Facebook 2018

4👍

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.

1👍

Update in case anyone else is struggling with this in 2020:

In facebook developers:

  1. create a test app from your main app
  2. settings -> basic, add localhost and 127.0.0.1 to app domains. set site url to https://localhost:8000
  3. Products -> facebook login -> settings. client, wen login enabled. Embedded Browser OAuth Login enabled.
    Add all of these into Valid OAuth Redirect URIs:
    https://127.0.0.1:8000/
    https://127.0.0.1:8000/accounts/facebook/login/callback
    https://localhost:8000/
    https://localhost:8000/accounts/facebook/login/callback

In django:

  1. pip install django-sslserver
  2. add sslserver to INSTALLED_APPS
  3. python manage.py runsslserver

In admin:

  1. Create 2 sites, https://127.0.0.1:8000/ and https://localhost:8000/
  2. Add a social application, facebook, add in your test app id and key. Register the 2 sites above into it.
👤Alex M

Leave a comment