创建Facebook测试用户时访问令牌的问题 [英] Problem with access token while creating Facebook Test Users

查看:120
本文介绍了创建Facebook测试用户时访问令牌的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的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创建与特定应用程序关联的测试用户应用程序访问令牌。这链接到Autenticating as an Application一节,并描述了这个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

所以现在我想把这个标记POST到图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."
    }
}

所以问题是:

  • 为什么我收到这个错误消息?
  • 我使用错误的访问令牌(尽管Facebook明确告诉我使用这一个?)
  • 我需要解析访问令牌吗?

    So the questions are:

  • Why am I getting this error message?
  • Am I using the wrong access token (despite Facebook explicitly telling me to use this one?)
  • Do I need to parse the access token somehow?

    感谢您的帮助。

    推荐答案

    这是一些工作代码,这将允许您使用PHP SDK创建测试用户。

    Here is some working code that will allow you to create a test user with the PHP SDK.

    这篇关于创建Facebook测试用户时访问令牌的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆