Testing 我可以访问测试用户的提要(自己的帖子)吗?
我正在尝试编写一些测试,以便从我的应用程序向facebook发布和评论。为此,我创建了两个测试用户,如使用我的应用程序机密中所述。然后,我尝试以第一个用户的身份创建一篇文章,并以第二个用户的身份留下评论。当第一步在第二步成功时,我收到一个错误:Testing 我可以访问测试用户的提要(自己的帖子)吗?,testing,facebook-graph-api,Testing,Facebook Graph Api,我正在尝试编写一些测试,以便从我的应用程序向facebook发布和评论。为此,我创建了两个测试用户,如使用我的应用程序机密中所述。然后,我尝试以第一个用户的身份创建一篇文章,并以第二个用户的身份留下评论。当第一步在第二步成功时,我收到一个错误: {"error":{"message":"(#100) Error finding the requested story","type":"OAuthException"}} 我还尝试通过以下方式访问创建的帖子: 直接通过id,使用https://g
{"error":{"message":"(#100) Error finding the requested story","type":"OAuthException"}}
我还尝试通过以下方式访问创建的帖子:
https://graph.facebook.com/
url,带有来自用户、我的应用程序和我的个人fb帐户的访问令牌https://graph.facebook.com//posts
url,也包括所有可能的访问令牌$ curl 'https://graph.facebook.com/oauth/access_token?client_id=<app_id>&client_secret=<app_secret>&grant_type=client_credentials'
access_token=<app_token>
$curl'https://graph.facebook.com/oauth/access_token?client_id=&client_secret=&grant_type=client_credentials'
访问令牌=
并创建测试用户:
$ curl 'https://graph.facebook.com/<app_id>/accounts/test-users?installed=true&permissions=publish_stream&method=post&access_token=<app_token>'
{"id":"100003312676861","access_token":"<user1_token>","login_url":"https:\/\/www.facebook.com\/platform\/test_account_login.php?user_id=100003312676861&n=mFdbI0ThjAcqEmR","email":"hrputis_fergiesen_1325848209\u0040tfbnw.net","password":"<user1_pass>"}
$curl'https://graph.facebook.com//accounts/test-users?installed=true&permissions=publish_stream&method=post&access_token='
{“id”:“100003312676861”,“访问令牌”:“登录url”:“https:\/\/www.facebook.com\/platform\/test\u account\u login.php?用户id=100003312676861&n=mFdbI0ThjAcqEmR”,“电子邮件”:“hrputis\u fergiesen\u 1325848209\u0040tfbnw.net”,“密码”:”
然后我尝试创建一个帖子,它成功了:
curl 'https://graph.facebook.com/100003312676861/feed?message=hello&method=post&access_token=<user1_token>'
{"id":"100003312676861_107495629370859"}
curl'https://graph.facebook.com/100003312676861/feed?message=hello&method=post&access_token='
{“id”:“100003312676861_107495629370859”}
但当我尝试访问创建的帖子时,我无法使用应用程序和用户令牌:
curl 'https://graph.facebook.com/100003312676861_107495629370859?access_token=<user1_token>'
false
curl 'https://graph.facebook.com/100003312676861_107495629370859?access_token=<app_token>'
false
curl'https://graph.facebook.com/100003312676861_107495629370859?access_token='
错误的
卷曲'https://graph.facebook.com/100003312676861_107495629370859?access_token='
错误的
而且它不会出现在用户的提要中
curl 'https://graph.facebook.com/100003312676861/feed?access_token=<user1_token>'
{"data":[]}
curl 'https://graph.facebook.com/100003312676861/feed?access_token=<app_token>'
{"data":[]}
curl'https://graph.facebook.com/100003312676861/feed?access_token='
{“数据”:[]}
卷曲'https://graph.facebook.com/100003312676861/feed?access_token='
{“数据”:[]}
更新2访问令牌详细信息:
对于应用程序令牌,linter正确识别ID和应用程序名称
对于用户令牌linter,请提供以下信息:
App ID: <correct app ID and name>
User ID: Unknown
Issued: 1326186000 : 1:00 am Jan 10 2012
Expires: 1326189600 : 2:00 am Jan 10 2012
Valid: True
Origin: Unknown
Scopes: create_note photo_upload publish_stream share_item status_update video_upload
应用程序ID:
用户ID:未知
发布时间:1326186000:2012年1月10日凌晨1:00
到期日期:1326189600:2012年1月10日凌晨2:00
有效:正确
来源:不详
范围:创建\u便笺照片\u上传发布\u流共享\u项目状态\u更新视频\u上传
使用测试用户帐户登录后,我来到graph API浏览器,为他们抓取了一个访问令牌。然后我检查了me/feed
,它是空的。正如预期的那样,因为它是一个新的测试用户帐户。然后,我使用浏览器向我/订阅源发送了一条帖子,图表返回了一个id!然后我又回到我的博客上,那篇新帖子被列出了。当我将该用户访问令牌带到linter时,它向我显示该令牌是针对测试帐户用户的,并且请求了正确的权限。您是否可以检查您在linter中尝试的用户访问令牌,以确保正确设置了访问令牌?请在此处发布您的结果:)林帖对您的访问令牌有何评论?我已经从林帖中添加了令牌信息。抱歉耽搁了,我有几天没有访问我的工作站。User ID:Unknown
该部分不正确。您使用了错误的访问令牌。但它是由FB API提供的。我应该在哪里获得正确的答案?阅读。它展示了几种获取用户访问令牌的方法。