Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Xamarin.Auth和Facebook身份验证获取电子邮件地址_Facebook_Xamarin_Oauth 2.0 - Fatal编程技术网

使用Xamarin.Auth和Facebook身份验证获取电子邮件地址

使用Xamarin.Auth和Facebook身份验证获取电子邮件地址,facebook,xamarin,oauth-2.0,Facebook,Xamarin,Oauth 2.0,我有以下代码来尝试连接验证器 var auth = new OAuth2Authenticator ( appId, "email", new Uri ("https://m.facebook.com/dialog/oauth/"), new Uri ("http://www.facebook.com/connect/login_success.html")); 当对话框显示时,我可

我有以下代码来尝试连接验证器

        var auth = new OAuth2Authenticator (
            appId,
            "email",
            new Uri ("https://m.facebook.com/dialog/oauth/"),
            new Uri ("http://www.facebook.com/connect/login_success.html"));
当对话框显示时,我可以看到它正在请求允许查看我的电子邮件。但是,我如何从该服务获得该电子邮件

我打以下电话获取Facebook ID

var request = new OAuth2Request ("GET", new Uri ("https://graph.facebook.com/me"), null, args.Account);
                request.GetResponseAsync ().ContinueWith (t => {
                    var obj = JsonValue.Parse (t.Result.GetResponseText ());
                    var id = obj ["id"];
                });
但我收到的回复中没有电子邮件。如何获取用户的电子邮件地址?

最新的API版本(撰写本文时为2.4版)使用声明性字段,因此您需要明确请求电子邮件字段,如下所示:


您好,我正在使用fields=email的链接,但它没有返回电子邮件Id。这是我的链接,请推荐。