简体   繁体   中英

reading messages from fb

I successfully login to facebook but while trying to read the mailbox I got the following error: {"(OAuthException - #298) (#298) Requires extended permission: read_mailbox"}

If I add that scope in the URL;

  var destinationUrl =
                    String.Format(
                        "https://www.facebook.com/dialog/oauth?client_id={0}&scope={1}&display=popup&redirect_uri=http://www.facebook.com/connect/login_success.html&response_type=token",
                        AppID, //client_id
                        "user_posts" //scope
                        );

and try to get mails:

 private void FaceBookScrapper()
        {
            var client = new FacebookClient(_fbToken);
            var input = new List<FbMesseage>();
            if (client != null)
            {
                dynamic result = client.Get("me/inbox", null);
                foreach (var item in result.inbox.data)
                {
                    if (item.unread > 0 || item.unseen > 0)
                    {
                        foreach (var message in item.comments.data)
                        {
                            input.Add(new FbMesseage
                            {
                                Id = message.id,
                                FromName = message.from.name,
                                FromId = message.from.id,
                                Text = message.message,
                                CreatedDate = message.created_time
                            });
                        }

                        FbMesseageCollectionViewModelIns.LoadData(input);
                    }
                }
            }
        }
    }
}

That permission doesn't exist any more - it has been removed, together with the /user/inbox endpoint.

https://developers.facebook.com/docs/apps/changelog#v2_4_deprecations mentions this, and https://developers.facebook.com/docs/graph-api/reference/v2.5/user/inbox as well.

Under the latter URL, it says it right on the very top of the page:

This document refers to a feature that was removed after Graph API v2.4.

There is no way any more to access a user's inbox via API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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