Facebook C# SDK trouble getting me/accounts

我的未来我决定 提交于 2019-12-07 00:38:38
avs099

see here: (OAuthException - #2500) An active access token must be used to query information about the current user

you are getting access token for the APPLICATION, not for a user. Therefore, "me" does not make sense. You should supply ID there - either your user ID, or your app ID, or any other ID your app has permissions for.

dynamic ac = fbClient.Get("oauth/access_token", new
{
    client_id = strAppID,
    client_secret = strSecret,
    grant_type = "client_credentials"
});

The above code may not work for version 6.0.

OAuth 2.0 - exchange code for access token

FacebookClient supports parsing only json responses. Due to this reason “oauth/access_token” token will not work when using FacebookClient.Get(“oauth/access_token”). Instead you will need to use a method in FacebookOAuthClient.

You can find more details here: http://blog.prabir.me/post/Facebook-CSharp-SDK-Making-Requests.aspx

Hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!