问题描述
我正在尝试将测试用户添加到我的 Facebook 应用程序,以便我可以更好地测试请求对话框并检查是否可以检索跟踪信息.但是我不断收到这个问题标题中的错误.这是我的代码:
I'm trying to add Test Users to my Facebook app so I could better test the Request dialog and check if I could retrieve the tracking information. But I keep getting the error in the title of this question. Here's my code:
[CanvasAuthorize]
public ActionResult Add()
{
var fb = new FacebookWebClient(FacebookWebContext.Current);
dynamic result = fb.Post(string.Format("{0}/accounts/test-users", FacebookWebContext.Current.Settings.AppId),
new { installed = false});
return Content(result.ToString());
}
奇怪的是,在调试时,我检查了当前上下文,看起来一切都很好.所有属性都在那里(包括 App Secret)并且没有空.为什么会这样?
The weird thing is that while debugging, I've checked the Current context and it seems like everything is fine. All properties are there (including the App Secret) and nothing null. Why is that happening?
更新: C# 相当于 file_get_contents (PHP)
推荐答案
我猜这个错误和旧命名有点误导,你需要的是一个 应用程序访问令牌.它在测试用户文档中有所提及:
I guess the error and the old naming is a bit misleading, what you need here is an application access token. And it's mentioned in the Test Users documentation:
您可以创建一个关联的测试用户使用图表的特定应用程序带有您的应用访问令牌的 API.
对于 PHP 用户,我写了一个关于如何获取此访问令牌的教程 此处.
For PHP users, I've written a tutorial on how to get this access token here.
这篇关于(OAuthException) (#15) 您正在调用的方法必须使用应用程序秘密签名会话调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!