首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Xamarin.Auth重新请求facebook权限

使用Xamarin.Auth重新请求facebook权限
EN

Stack Overflow用户
提问于 2016-08-23 02:47:08
回答 1查看 279关注 0票数 0

我正在尝试重新请求Facebook中被拒绝的权限。

根据facebook开发人员的说法,一旦有人拒绝了权限,登录对话框就不会重新要求他们,除非你明确地告诉对话框你正在重新请求被拒绝的权限。

您可以通过将auth_type=rerequest参数添加到您的登录名来执行此操作。

我做了这个,但多森不行了

代码语言:javascript
复制
var auth = new OAuth2Authenticator(
            clientId: "my app id", // your OAuth2 client id
            scope: "email", // the scopes for the particular API you're accessing, delimited by "+" symbols
            authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"),
            redirectUrl: new Uri("http://www.facebook.com/connect/login_success.html"));

        progressDialog.Show();
        auth.Completed += async (sender, eventArgs) =>
        {
            if (eventArgs.IsAuthenticated)
            {
                var accessToken = eventArgs.Account.Properties["access_token"].ToString();
                var expiresIn = Convert.ToDouble(eventArgs.Account.Properties["expires_in"]);
                var expiryDate = DateTime.Now + TimeSpan.FromSeconds(expiresIn);

                IDictionary<string, string> hashRequest = new Dictionary<string, string>();
                hashRequest.Add("auth_type", "rerequest");

                var request = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me?fields=education,email,location,name"),hashRequest, eventArgs.Account);
                var response = await request.GetResponseAsync();
                var obj = JObject.Parse(response.GetResponseText()); ...
EN

回答 1

Stack Overflow用户

发布于 2016-08-23 04:41:35

我解决了将一些属性附加到html请求的问题。

代码语言:javascript
复制
    var auth = new OAuth2Authenticator (
            clientId: "myappid", // your OAuth2 client id
            scope: "email", // the scopes for the particular API you're accessing, delimited by "+" symbols
            authorizeUrl: new Uri ("https://m.facebook.com/dialog/oauth?auth_type=rerequest&client_id=myappid&" +
                                  "redirect_uri=http://www.facebook.com/connect/login_success.html&scope=email/"),
            redirectUrl: new Uri ("http://www.facebook.com/connect/login_success.html"));
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39086668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档