【问题标题】:Rerequest a facebook permission with Xamarin.Auth使用 Xamarin.Auth 重新请求 facebook 权限
【发布时间】:2016-08-22 18:47:07
【问题描述】:

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

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

您可以通过将auth_type=rerequest 参数添加到您的登录来做到这一点。

我做了这个,但是不工作

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()); ...

【问题讨论】:

    标签: facebook xamarin xamarin.android xamarin.auth


    【解决方案1】:

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

        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"));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-04
      • 1970-01-01
      • 2015-09-17
      • 2015-08-23
      • 2015-04-16
      • 2015-02-22
      • 2015-02-20
      相关资源
      最近更新 更多