Django Angular Facebook authentication

angularjs, django, facebook-authentication

Solution

I wrote a small article on this subject as it seems it was not clearly explained anywhere. I found it easily done with django-rest-framework instead of tastypie though.

Here are the main steps used to authenticate (I’ll try to add a little schema to illustrate) :

- On the angular side, user authenticate on facebook with Oauth.io API (it could be directly with Facebook js API).

- Client gets a Facebook authentication token.

- FB token is used to ask for authentication on server side.

- python-social-auth authenticate with FB with the given token.

- django-rest-framework sends back to client a auth token for REST API calls.

- Angular client passes the token in headers when making API calls.

You can find my article here about facebook angularjs auth with a django rest backend

Problem

I want to do a very simple web app where you can log-in using your facebook account. I am very comfortable with the `django` framework and also `angularjs`. I have an idea how to integrate these two using `tastypie` api framework for django. So if I am correct django's backend would be throwing some JSON which can be used by angularjs and so on. Where I am confused is the authentication mechanism with facebook. How do I integrate the Facebook's authentication with my app ? What would be a good design for such an app ? I am not expecting a complete design or architecture for my app from anyone , but some direction so that I can go forward with the app . Thanks :)

Original source