(OAuthException) (#200) User must have accepted TOS on C# - Facebook

試著忘記壹切 提交于 2019-12-20 03:19:08

问题


Well, I am trying make a app to write comments to facebook in C#. Searching in google I know that I need an Application (I did it) and I need select the permissions. I did it.. Now I wrote my code in C#:

private string MyAppId = "XXX";
private string MyAppSecret = "XXX";
private void button1_Click(object sender, EventArgs e)
{
  FacebookClient FB = new FacebookClient(MyAppId, MyAppSecret);
  Dictionary<string,string> data = new Dictionary<string,string>();
  data.Add("message","test");
  FB.Post("OBJECT_ID/comments", data);
}

But when I click the button I get this error:

(OAuthException) (#200) User must have accepted TOS

I am getting crazy! Please help me =(


回答1:


It doesn't look like you're actually using the users access token.

You need to go through the OAuth workflow, where the user is redirected to facebook.com and grants your application permission. Once that happens, you'll get an Access Token that you use to make requests on behalf of the user.

There's an overload for the FacebookClient class that will take an access token.

Since you didn't really expand on the type of app you're writing, the Facebook C# Github page has a collection of samples, for WinForms, ASP.NET, and Windows 8 Metro. This example should show you how to do client-side authentication.

You're also trying to post to OBJECT_ID, which isn't a valid user/post/page.



来源:https://stackoverflow.com/questions/13243286/oauthexception-200-user-must-have-accepted-tos-on-c-sharp-facebook

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