Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my javascript code:

JavaScript
my js code is below:
(function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
window.fbAsyncInit = function () {
    FB.init({
        appId: '935846336454759',
        cookie: true,  // enable cookies to allow the server to access 
        // the session
        status: true,
        xfbml: true,  // parse social plugins on this page
        version: 'v2.3', // use version 2.3
        oauth: true // enable OAuth 2.0
    });

    FB.getLoginStatus(function (response) {
        statusChangeCallback(response);
    });
};
function FBLogin() {
    FB.login(function (response) {
        if (response.authResponse) {
            getUserInfo(); //Get User Information.
        } else {
            alert('Authorization failed.');
        }
    }, {
        scope: 'public_profile,email',
        return_scopes: true
    });
}
function getUserInfo() {
    FB.api('/me', function (resp) {
        console.log(resp);       
    });
}

HTML
<--on button click FBLogin() method calls  -->
<button value="facebook" class="facebook" onclick="FBLogin()"> </button>


In Response in i m getting something like below:

Object{name:"Harmeet Kamboj",id:"8279848306534449"}

please Help Out!!!
Posted
Comments
ZurdoDev 9-Nov-15 8:04am    
Does facebook api support returning the email?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900