必须使用应用程序 access_token 调用此方法 [英] This method must be called with an app access_token

查看:14
本文介绍了必须使用应用程序 access_token 调用此方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在论坛/网络上搜索了几天后,我仍然无法摆脱它并使用 SCORE 图 api

After days of searching the forums/net, I still couldn't get this to go away and use the SCORE graph api

{
  "error": {
  "message": "(#15) This method must be called with an app access_token.", 
  "type": "OAuthException", 
  "code": 15
  }
}

在图形 api 资源管理器上,我尝试使用它(激活了发布操作权限并选择了 POST):

On the graph api explorer i tried using this (with publish_actions permission activated & POST selected):

https://graph.facebook.com/100003429183160/scores?score=555&access_token=APP_ACCESS_TOKEN

运气不好:(

我做了以下事情:

• 将我的应用设置为游戏、基本信息、设置身份验证对话框

• Set my app as a GAME, the basic info, setup the Auth Dialog

• 设置开放图谱类型、对象、聚合

• Setup the Open Graph type, object, aggregation

• 通过访问令牌工具使用/验证正确的 APP ACCESS_TOKEN(不是用户 access_token)

• Use/Verify the right APP ACCESS_TOKEN (not the user access_token) via Access Token Tool

• 使用 publish_actions 权限

• Use the publish_actions permission

• 确保它使用 POST 作为方法

• Made sure it's using POST as method

• 尝试将 appID|appSecret 作为应用访问令牌

• Tried appID|appSecret as an app access_token

• 验证我确实安装了该应用

• Verified that I indeed installed the app

• 可以通过图形api、拉好友列表和照片等方式发布到墙上.

• Was able to post to a wall via graph api, pull friends list and photos, etc.

还有什么其他线索会导致它无法与 Graph API Explorer 一起运行吗?

Any clues what else could cause this not to run with the Graph API Explorer?

推荐答案

答案:-

实际上,要使用 SCORE Graph API,您需要不同于普通访问令牌的应用程序访问令牌"

Actually for using SCORE Graph API you need the "Application access token" which is different than a normal access token

因此,如果您希望完成任务,请使用以下脚本获取应用程序访问令牌......

So if you want your task to be done GET an Application access token by using the following script.......

然后用旧的access_token替换生成的application_access_token,就这样

And then replace the generated application_access_token with old access_token, that's it

$APPLICATION_ID = "APP_ID";
$APPLICATION_SECRET = "APP_SECRET";

$token_url =    "https://graph.facebook.com/oauth/access_token?" .
                "client_id=" . $APPLICATION_ID .
                "&client_secret=" . $APPLICATION_SECRET .
                "&grant_type=client_credentials";
$app_token = file_get_contents($token_url);

获得此应用程序访问令牌后,您可以轻松完成此任务.

After getting this application access token you can easily do this task.

当您需要应用程序访问令牌时

当您有代表应用程序而不是代表特定用户的进程时,您需要使用 Facebook 应用程序访问令牌.当您通过图表访问您的应用的 Facebook 洞察数据时,以及当您想要为您的应用创建测试 Facebook 用户时,就会发生这种情况.

You need to use a Facebook application access token when you have a process that acts on behalf of the application, rather than on behalf of a particular user. This happens when you access your Facebook Insights data for your app via the graph, and also when you want to create test Facebook users for your app.

遗憾的是,相关文档隐藏在 Facebook 图形 API 的身份验证指南中.

Sadly, the documentation for this is buried in the authentication guide for the Facebook graph API.

这篇关于必须使用应用程序 access_token 调用此方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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