Facebook works similar to Twitter but it’s simpler to setup and redirect URL is passed as a parameter when issuing an authorization. Further documentation can be found at Facebook development resources:

The steps below will get django-social-auth connected to your app running on localhost.

  1. Register a new application at Facebook App Creation, follow along with the screenshots to setup your app:

  2. ../_images/facebook_1.jpeg
  3. ../_images/facebook_2.jpeg
  4. Back to your django settings.py file, fill in the App ID and App Secret values from the blue box in step #3

    FACEBOOK_APP_ID='App ID here'
    FACEBOOK_API_SECRET='App Secret here'
  5. Make sure that you have the Facebook backend added to AUTHENTICATION_BACKENDS

  6. You should now have Facebook enabled on localhost.

Facebook Extended Permissions

This is an optional step and only needed if you require extra information from Facebook such as email addresses, etc.

  • In django settings.py, define FACEBOOK_EXTENDED_PERMISSIONS to get extra permissions from facebook. For example, Facebook doesn’t return user email by default, this setting is needed if email is required:

  • Define FACEBOOK_PROFILE_EXTRA_PARAMS to pass extra parameters to https://graph.facebook.com/me when gathering the user profile data, like:


Facebook Canvas

If you need to perform authentication from Facebook Canvas application: - Create your canvas application at http://developers.facebook.com/apps - In Facebook application settings specify your canvas URL

mysite.com/fb (current default)
  • Setup your Django Social Auth settings like you usually do for Facebook authentication (FACEBOOK_APP_ID etc)
  • Launch manage.py via sudo ./manage.py runserver mysite.com:80 for browser to be able to load it when Facebook calls canvas URL
  • Open your Facebook page via http://apps.facebook.com/app_namespace or better via http://www.facebook.com/pages/user-name/user-id?sk=app_app-id
  • After that you will see this page in a right way and will able to connect to application and login automatically after connection

More info on the topic at Facebook Canvas Application Authentication.