views:

40

answers:

2

Can i get my facebook's email address when i log in facebook from facebook connect api?Thanks.

A: 

You mean like this? http://wiki.developers.facebook.com/index.php/Users.getInfo

bpeterson76
A: 

If you ask for the email permission, then you can get it using the Graph API. For example: http://fbrell.com/fb.api/user-info:

<fb:login-button perms="email"></fb:login-button>
<div id="me"></div>

<script>
var
  div    = document.getElementById('me'),
  showMe = function(response) {
    if (!response.session) {
      div.innerHTML = '<em>Not Connected</em>';
    } else {
      FB.api('/me', function(response) {
        var html = '<table>';
        for (var key in response) {
          html += (
            '<tr>' +
              '<th>' + key + '</th>' +
              '<td>' + response[key] + '</td>' +
            '</tr>'
          );
        }
        div.innerHTML = html;
      });
    }
  };
FB.getLoginStatus(function(response) {
  showMe(response);
  FB.Event.subscribe('auth.sessionChange', showMe);
});
</script>
daaku