Amitav Roy

Blog on web and travel

Facebook User Login using Javascript in Angular JS

Posted on by Amitav Roy

In this short tutorial, I will show you how to use the Facebook javascript SDK to creating a login. The user will be presented with the Facebook login and he needs to add the permissions to our app. Once done, we will on success get the user’s object as response. And then we will also fetch the FB access token.

The Video

I have made a basic setup of the application in Angular JS with some boilerplate code. Using that we present a login button on clicking that the Facebook pop up opens. Once the authentication is done, we get the data inside Angular to play with. Also with another method, we will get the access token from Facebook server.

We have done this so that using this FB access token, we will validate it on our own oauth server to check that the user is a valid Facebook user and then give him an access token from our own site. Using that token he can then request all data from our REST urls.