How to get email address?
I am using Facebook Developer Toolkit 3.1. I am trying to use Facebook connect in my website. I do get some basic information like firstname, lastname etc. But i do not get email address which is extremely important for my site. This is my code :-
private Api _fb;
readonly BrowserSession _browserSession;
private const string ApplicationKey = "myappkey";
private const string ApplicationSecret = "myappsecret";
private const string _emailAddress = "abc@yahoo.com";
_browserSession = new BrowserSession(ApplicationKey);
_browserSession.SessionSecret = ApplicationSecret;
_fb = new Api(_browserSession);
_fb.Users.GetInfoAsync(new Users.GetInfoCallback(OnGetUserComp开发者_如何学Cleted), null);
private void OnGetUserCompleted(IList<user> users, Object state, FacebookException ex)
{
if (ex == null)
{
DispatcherHelper.Invoke(() =>
{
user u = users.First();
});
}
}
I have essentially stripped off the unnecessary code. I am getting user
in users.First()
. However there is no email address present in it. Please tell me where am i wrong.
NOTE :- I am using Silverlight for my application which is why you see the Aysnc callbacks.
Thanks in advance :)
You have to let the users of your application to give you the permission to read their email.
< fb:login-button perms="email" > Login with Facebook < /fb:login-button >
http://developers.facebook.com/docs/guides/web
精彩评论