[英](OAuthException) (#200) User must have accepted TOS on C# - Facebook
Well, I am trying make a app to write comments to facebook in C#. 好吧,我正在尝试制作一个应用程序以C#将评论写到Facebook。 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#:
我做到了。现在我用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
(OAuthException)(#200)用户必须已接受TOS
I am getting crazy! 我快疯了! Please help me =(
请帮助我=(
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. 您需要完成OAuth工作流程 ,在该工作流程中 ,用户将被重定向到facebook.com并授予您的应用程序许可权。 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. FacebookClient类有一个重载,它将获取访问令牌。
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. 由于您并未真正扩展正在编写的应用程序的类型,因此Facebook C#Github页面包含用于WinForms,ASP.NET和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. 您还尝试发布到OBJECT_ID,这不是有效的用户/帖子/页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.