javascript - Fetching Mail Id in Login with Facebook? -


how can fetch mail id in login facebook option.i created sample project , can fetch username,but cant fetch mail id.

my coding following.

i created app id , implement in following code.

  window.fbasyncinit = function () {         fb.init({             appid: '###############',             cookie: true,  // enable cookies allow server access             // session             xfbml: true,  // parse social plugins on page             version: 'v2.5' // use version 2.2         });           fb.getloginstatus(function (response) {             statuschangecallback(response);         });      };     function statuschangecallback(response) {         console.log('statuschangecallback');         console.log(response);           if (response.status === 'connected') {              testapi();         } else if (response.status === 'not_authorized') {              document.getelementbyid('status').innerhtml = 'please log ' +               'into app.';         } else {              document.getelementbyid('status').innerhtml = 'please log ' +               'into facebook.';         }     }     function testapi() {         var id, eid, username;         console.log('welcome!  fetching information.... ');         fb.api('/me', function (response) {             console.log('successful login for: ' + response.name);             document.getelementbyid('status').innerhtml =               'thanks logging in, ' + response.name + '!' + response.id + ' ' + response.phoneno + ' ' + response.country;             username = response.name;             eid = response.email;             id = response.id;          });           $.ajax({             type: 'post',             contenttype: "application/json; charset=utf-8",             url: 'loginwithfb.aspx/fbacctdeta',             data: "{username:'" + username + "',eid:'" + eid + "',id:'" + id + "'}",             async: true,             success: function () {                 alert(data);             }         });     } 

you can fetch mail id , other information after facebook completes app review of app @ developer option of facebook developers

for getting client info

facebookclient fb = new facebookclient(); dynamic info=fb.get("\me"); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -