创建 Facebook 测试用户时访问令牌的问题 [英] Problem with access token while creating Facebook Test Users
问题描述
我正在尝试为我的 Facebook 应用程序创建测试用户.他们在 11 月的这篇博文 (http://developers.facebook.com/blog/post/429) 中宣布了此功能,并记录在此处 (http://developers.facebook.com/docs/test_users/).我在别处找不到这个问题的答案...
I'm trying to create test users for my Facebook application. They announced this functionality in this blog post in November (http://developers.facebook.com/blog/post/429) and it is documented here (http://developers.facebook.com/docs/test_users/). I could not find the answer to this elsewhere...
根据文档,您可以使用 Graph API 和应用程序访问令牌创建与特定应用程序关联的测试用户."这链接到作为应用程序进行身份验证"部分并描述了这个 CURL 脚本:
According to the documentation, "You can create a test user associated with a particular application using the Graph API with the application access token." This links to the section "Autenticating as an Application" and describes this CURL script:
curl -F grant_type=client_credentials
-F client_id=your_app_id
-F client_secret=your_app_secret
https://graph.facebook.com/oauth/access_token
到目前为止,一切都很好.我运行了这个并得到以下结果:
So far, so good. I ran this and get the following:
access_token=1182...18|nTI...r5Q
所以现在我想将此令牌发布到图形 api 测试用户 URL:
So now I want to POST this token to the graph api test user URL:
POST /1182...18/accounts/test-users?installed=true&permissions=read_stream&access_token=1182...18|nTI...r5Q
当我这样做(使用 Facebook PHP SDK 并在浏览器中输入)时,我得到:
When I do this (both using the Facebook PHP SDK and just typing it into the browser) I get:
{
"error": {
"type": "OAuthException",
"message": "Invalid OAuth access token."
}
}
所以问题是:
So the questions are:
感谢您的帮助.
推荐答案
这里有一些 工作代码,允许您使用 PHP SDK 创建测试用户.
Here is some working code that will allow you to create a test user with the PHP SDK.
这篇关于创建 Facebook 测试用户时访问令牌的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!