Retrieve user profile from facebook in NodeJS

Posted By : Udit Kaul | 25-May-2016

In some scenarios you need to retieve user profile details from facebook

I assume that you have obtained an access token and if not here is the link to generate an access token https://developers.facebook.com/tools/explorer for testing purposes.

    var Protocol='https://';
    var facebookHost='graph.facebook.com'
    var facebookPath='/me?fields=email,id,gender,first_name,last_name&access_token=';  //The fields attribute can have list of all the information you want to retrieve such as picture to the get the link of the user's display picture

var fbUrl = Protocol+facebookHost+facebookPath+token;

  async.auto({

            res:function(next,result){
                    return configurationHolder.http.get(fbUrl,next)
            }
        },function(err,results){

          //results will hold user profile data  retrieved from facebook

         })

Hope tha the information was helpful,

THANKS

About Author

Author Image
Udit Kaul

Udit is a Bright Web App developer, he is OCJP ,OCWCD and OCPLSQL certificated. He has good knowledge of Java and SQL. He likes playing football and very much interested in other sports too.

Request for Proposal

Name is required

Comment is required

Sending message..