Easiest way to authenticate is to use a facebook button , where user need to click for authentication. simple implimentation is as follows:
The above code will render as a Facebook branded button which will show whether a user is logged in or not on your application/website. If not, it will show login text, after clicking on it, a small pop-up window will appear to the user with the request permission page. After use allows the permission, this window will close, the button will show logout text as user is now logged in after allows the permission.
You can also implement this login functionality on some other way, on some other events. For that, please use “FB.Login()” method.
Lets take a simple example to retrieve the user information who is currently using the application. Use the code as follows:
Happy coding 🙂