This is a python app to use the new Graph API authentication with Django. It uses the standard authentication build into Django.
- Put the files into a folder named 'facebook' in your Django project.
- Add the facebook context processor to
TEMPLATE_CONTEXT_PROCESSORS
in settings.py:"facebook_oauth.context_processors.facebook",
- Add the facebook authentication backend to settings.py
AUTHENTICATION_BACKENDS = ('facebook_oauth.backend.FacebookBackend')
- Add facebook app to
INSTALLED_APPS
in settings.py: `'facebook_oauth', - Add
FACEBOOK_APP_ID
andFACEBOOK_APP_SECRET
to settings.py - Add this line to the urlpatterns in urls.py
(r'^facebook/', include('facebook_oauth.urls')),
- Run
python manage.py syncdb
- Add
{{ fb_user.facebook_id }}
to a template. It should show the logged in user's facebook id. - Test by going to '/facebook/authenticate' then to the template you added the facebook id to
To use the template tag to view the current user, add the following line to a template
{% load pictures %}{% facebook_profile_picture fb_user.facebook_id %}