facebook - 如何使用新的客户端 Facebook 通知 API

标签 facebook facebook-graph-api notifications

官方文档https://developers.facebook.com/docs/app_notifications/说:

  1. "Apps can send notifications to any existing user that has authorized the app. No special or extended permission is to required."

  2. "All notifications from an app are treated the same way, independent of how it was sent - via this API or as a user-to-user request."

服务器端 API 工作正常,但我决定直接从 Flash 客户端调用通知 API。我已请求 {recipient_userid}/notifications 以及所有必要的东西,例如客户端 token 等。

我第一次收到错误 200。在为应用程序应用 ma​​nage_notifications 权限后,我收到了新类型的错误 606(“您无权为此用户获取通知”)。

我的问题是可以通过客户端请求向 Graph API 发送通知吗?是否需要额外的权限?

最佳答案

正如您从 fb 文档中看到的那样:

Note: Only apps on Facebook.com can use the Notifications API. Also these notifications are only surfaced on >desktop version of Facebook.com.

这意味着在发布通知时,您必须使用应用程序访问 token - 而不是通常的用户访问 token 。

您必须先获取应用程序访问 token :

GET https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials

然后在发布到图形 api 时使用此访问 token 。

关于facebook - 如何使用新的客户端 Facebook 通知 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12266593/

相关文章:

facebook - 使用图谱 API 获取(识别)对评论的回复

Facebook OpenGraph DateTime 属性,只有日期被解析为 DateTime

ios - 在iOS中的Facebook登录中检查是否已在此应用程序中注册

Facebook publish_action 权限不适用于发布

java - AlarmManager 和接收器的多重通知 Android Studio Java

facebook - 获取用户所有未完成的 Facebook 请求

php - facebook 如何知道需要从 URL 获取哪些图像?

facebook - 在 FB 图形 API 中获取 friend 的 friend

javascript - 如何在 Electron 应用程序中切换 Notification.permission?

安卓最近应用检测