简体   繁体   English

如何获得电子邮件地址?

[英]How to get email address?

I am using Facebook Developer Toolkit 3.1. 我正在使用Facebook Developer Toolkit 3.1。 I am trying to use Facebook connect in my website. 我正在尝试在我的网站中使用Facebook连接。 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(OnGetUserCompleted), 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() . 我在users.First()获得user 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. 注意:-我正在为我的应用程序使用Silverlight,这就是为什么您看到Aysnc回调的原因。

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 > <fb:login-button perms =“ email” >使用Facebook登录</ fb:login-button>

http://developers.facebook.com/docs/guides/web http://developers.facebook.com/docs/guides/web

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM