title: Django All-Auth Facebook Integration
body: <p>I am having problems setting up the Facebook social integration for Django All-Auth. I have successfully setup the Google login, so I am at a loss as to why one works and the other doesn't. I think it might be due to my Facebook configuration in settings.py, as Facebook has many possible options.</p>
  
  <p><strong>Events Summary:</strong></p>
  
  <ul>
  <li>Click Login by Facebook Button on my website</li>
  <li>Browser redirects to Facebook website for login, and facebook requests password.</li>
  <li>Facebook accepts the password</li>
  <li>Browser redirects back to my website but gives the following error: "Social Network Login Failure, An error occurred while attempting to login via your social network account."</li>
  <li>Login failed</li>
  </ul>
  
  <p>Any idea how I can diagnose what exactly is causing the problem?</p>
  
  <p><strong>Example webhost message:</strong></p>
  
  <pre><code>[16/Nov/2016 02:14:37] "GET /accounts/facebook/login/callback/?code=AQArXlYq-4K8
  UBnuACFQZK39HvVAkZzYpnkP4hI223Y5kA1JmmjdF5yOeVHnrDRpxMOPFNviDzYeSSBvWccALZHGTl-8
  7_A1-jtwpDF0UdgoGSVVd9KsrGrQDrHi0i6X9l_pO76-_Ro0N8ePr4L7uUd2G3aWAlZVtAKNNPG1kNBf
  OIwhb_RFRJrFvdLA5TlUXaGFdkEsRdMawyG8tdAstXdm5FcxKBRYMOE98j3yalHm5oLLeXOMKJ14EdDw
  8-DHU6f5Ze1DWaWWUd-3MFP-NvF2sG4XbA6n5McPrLgYZKb_YG8Slqgo5GDVrKHT1tNedzgceCjjDXT3
  TfbzZc9e-aQT9EycKAdGDr1TkKw9lO-Lqw&amp;state=5WqSSFEKy5bc HTTP/1.1" 200 8243
  </code></pre>
  
  <p><strong>Example URL after return from Facebook:</strong></p>
  
  <pre><code>http://127.0.0.1:8000/accounts/facebook/login/callback/?code=AQArXlYq-4K8UBnuACFQZK39HvVAkZzYpnkP4hI223Y5kA1JmmjdF5yOeVHnrDRpxMOPFNviDzYeSSBvWccALZHGTl-87_A1-jtwpDF0UdgoGSVVd9KsrGrQDrHi0i6X9l_pO76-_Ro0N8ePr4L7uUd2G3aWAlZVtAKNNPG1kNBfOIwhb_RFRJrFvdLA5TlUXaGFdkEsRdMawyG8tdAstXdm5FcxKBRYMOE98j3yalHm5oLLeXOMKJ14EdDw8-DHU6f5Ze1DWaWWUd-3MFP-NvF2sG4XbA6n5McPrLgYZKb_YG8Slqgo5GDVrKHT1tNedzgceCjjDXT3TfbzZc9e-aQT9EycKAdGDr1TkKw9lO-Lqw&amp;state=5WqSSFEKy5bc#_=_
  </code></pre>
  
  <p><strong>Facebook Valid OAuth redirect URI:</strong></p>
  
  <ul>
  <li><a href="http://127.0.0.1:8000/accounts/facebook/login/callback/" rel="nofollow noreferrer">http://127.0.0.1:8000/accounts/facebook/login/callback/</a></li>
  </ul>
  
  <p><strong>Facebook Settings:</strong></p>
  
  <ul>
  <li>Client OAuth Login - Enabled </li>
  <li>Web OAuth Login - Enabled </li>
  <li>Embedded Browser OAuth Login - Enabled</li>
  </ul>
  
  <p><strong>Admin Settings:</strong></p>
  
  <ul>
  <li>Client ID, Secret ID input</li>
  <li>Site 1 set as localhost</li>
  </ul>
  
  <p><strong>Settings.py Apps:</strong></p>
  
  <pre><code>INSTALLED_APPS = [
      'home',
  
      # Django Standard Apps
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
      # Django Crispy forms
      'crispy_forms',
  
      # Django allauth
      'django.contrib.sites',
      'allauth',
      'allauth.account',
      'allauth.socialaccount',
      'allauth.socialaccount.providers.facebook',
      'allauth.socialaccount.providers.google',
  ]
  </code></pre>
  
  <p><strong>Settings.py Social:</strong></p>
  
  <pre><code>SOCIALACCOUNT_PROVIDERS = \
      {
      'facebook':
      {'METHOD': 'oauth2',
      'SCOPE': ['email', 'public_profile'],
      'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
      #'FIELDS': [
      #'id',
      #'email',
      #'name',
      #'first_name',
      #'last_name',
      #'verified',
      #'locale',
      #'timezone',
      #'link',
      #'gender',
      #'updated_time'],
      'EXCHANGE_TOKEN': True,
      #'LOCALE_FUNC': 'path.to.callable',
      'VERIFIED_EMAIL': False,
      'VERSION': 'v2.4'},
  
      'google':
      { 'SCOPE': ['profile', 'email'],
      'AUTH_PARAMS': { 'access_type': 'online' } }
      }
  </code></pre>
  
  <p>I uploaded this configuration with different redirect URIs to a test server with SSL and still have the same problem. Any ideas how I can fix this?</p>
  
  <p>I am running Python 3.5.2, and the latest pip install for all-auth.</p>
  
  <p>Thanks
  Stephen</p>