You can do this using the Javascript SDK on your web page.
The following solution uses the xocialCore plugin. In fact, you can simply extract the first two functions from this plugin as they provide the necessary functions for this.
https://github.com/xocialhost/jquery.xocialCore.js/blob/master/jquery.xocialCore.js
First you need to create and configure your facebook application. Make sure you fill in the website information with your URL / domain.
On the registration page, make sure you enable jQuery and then the above plugin.
Create a button on your page, for example:
<button id="fbLoginButton">Login</button>
and then run the following code:
$.xcInitFacebook({appId:'yourFBappId',callback:function(){ $('#fbLoginButton').click(function(event){ event.preventDefault(); $.xcFbLogin({permissions:'manage_pages, offline_access, email',callback:function(){ FB.getLoginStatus(function(response) { var fbUrl='https://graph.facebook.com/'+response.authResponse.userID+ '?fields=email,first_name,last_name,picture'+ '&access_token='+response.authResponse.accessToken; $.getJSON(fbUrl,function(data){
The response from the Facebook server should look something like this:
{ "email": "emailid\u0040domain.com", "first_name": "fName", "last_name": "lName", "id": "12345", "picture": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/49860_12345_8441_q.jpg" }
You will obviously want to do this further when you check to see if the user is already registered and then displays the login button or not, but this should provide you with the requested information about the user.