[英]Real-Time Subscriptions
Good afternoon, I'm using version 5.4.1 of the Facebook C# SDK. 下午好,我正在使用Facebook C#SDK的5.4.1版本。 I should note that I am using the source code directly rather than the DLLs (in case this makes any difference). 我应该注意到我直接使用源代码而不是DLL(如果这有任何区别)。
So the fact that filter attributes are setup is awesome (thank you dev team :). 因此,设置过滤器属性的事实很棒(谢谢开发团队:)。
My issue is occurring during the initial request (before I get to using verifying the GET response from Facebook) 我的问题发生在初始请求期间(在我使用验证来自Facebook的GET响应之前)
Here is my initial request: 这是我最初的要求:
dynamic result = fb.Post(
string.Format("/{0}/subscriptions",
FacebookApplication.Current.AppId),
new Dictionary<string, object>
{
{"object", "user"},
{"fields", "friends"},
{
"callback_url",
"http://localhost:16917/subscription/verify"
},
{
"verify_token",
"77FB802F-1147-48F0-BB0F-E4E9BC1FBCFC"
}
});
I'm finding that an exception is internally being thrown and via Fiddler I'm seeing that the request is never going out. 我发现内部被抛出一个异常并且通过Fiddler我看到请求永远不会消失。 The exception is: 例外是:
$exception {"(OAuthException) (#15) This method must be called with an app access_token."} System.Exception {Facebook.FacebookOAuthException}
I initially thought this may be related to Facebook.FacebookClient's PrepareRequest method: 我最初认为这可能与Facebook.FacebookClient的PrepareRequest方法有关:
if (httpMethod == HttpMethod.Get)
{
// for GET, all parameters goes as querystrings
input = null;
queryString.Append(FacebookUtils.ToJsonQueryString(parameters));
}
else
{
if (parameters.ContainsKey("access_token"))
{
queryString.AppendFormat("access_token={0}", parameters["access_token"]);
parameters.Remove("access_token");
}
}
but commenting out the line parameters.Remove("access_token");
但注释掉行parameters.Remove("access_token");
删除parameters.Remove("access_token");
made no difference. 没有区别。
Any help would be greatly appreciated! 任何帮助将不胜感激!
What access_token are you using? 你使用什么access_token?
Are you using a User's access token, or an App access token? 您使用的是用户访问令牌还是App访问令牌?
If you are using an User's access token take a look here http://developers.facebook.com/docs/authentication/#app-login on how to get an App access token. 如果您使用的是用户访问令牌,请查看http://developers.facebook.com/docs/authentication/#app-login ,了解如何获取App访问令牌。
You will need to use the app access_token. 您需要使用app access_token。
You can easily create an app access_token using the following constructor. 您可以使用以下构造函数轻松创建app access_token。
var fb = new FacebookClient("appid", "appsecret");
dynamic result = fb.Post( .... );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.