如何确定应用程序是否获得粉丝页面授权

发布于 2024-12-01 10:39:24 字数 544 浏览 1 评论 0原文

如果以前有人问过这个问题,请原谅我,但我无法找到这个看似简单的问题的答案。我有一个已授权给用户的应用程序通过我构建的网站的过程来访问用户的粉丝页面。流程是这样的:

访问网站-->授权网站查看粉丝页面列表 -->选择粉丝页面将应用程序安装到 -->将应用程序授权给用户帐户 -->将应用程序授权给粉丝页面

我已经完成了所有工作(一个过程,让我告诉你),并且一切都按预期运行。我正在开发一个管理界面来管理该应用程序,该应用程序不位于 Canvas 应用程序位置,而是位于网站本身。我还没有找到一种方法来确定该应用程序是否已安装。 Graph API / FQL 似乎不支持此功能。

我的两个问题是:

  • 我有用户 ID &粉丝页面 ID,但我无法确定该粉丝页面是否已授权我的应用程序。根据这个答案将确定我是显示“安装此应用程序”面板还是管理面板。

  • 我读到,最好的方法是在应用程序最初获得授权时存储用户 ID,但是在应用程序获得授权后,用户会被发送到粉丝专页的墙,我不知道如何通知我的用户iframe 应用程序。

Forgive me if this has been asked before, but I was unable to find an answer to what seems a simple question. I have an app that is authorized to a user & user's fan page via a process from a website I've constructed. The process is this:

Visit Website --> authorize website to view list of fan pages --> Select Fan Page to install app to --> Authorize app to user account --> Authorize app to Fan Page

I've got all that working (a process, let me tell you), and everything functions as intended. I'm working on an admin interface to manage the app which is not housed in the Canvas App location but on the website itself. I haven't found a way to figure out if the app is installed or not. It appears that the Graph API / FQL doesn't support this.

My two issues are:

  • I have the user id & the fan page id but I can't figure out whether said fan page has my app authorized or not. Depending on this answer will determine whether I show the "Install This App" panel or the Administration panel.

  • I've read that the best method is to store the userid when the app is initially authorized, but after the app is authorized, the user is sent to the Fan Page's Wall and I can't figure out how to notify my iframe app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

疯狂的代价 2024-12-08 10:39:24

[编辑]我误解了你的问题,并认为你的实现比你看起来的要少:如果你拥有用户的 manage_pages 权限,你可以获得每个页面的页面访问令牌,并访问当前作为该页面上的选项卡安装的应用程序列表 - 说明位于 https://developers.facebook.com/docs/reference/api/page/#tabs
[/edit]

对应用程序的“页面选项卡 URL”发出的每个请求都将包含一个signed_request 参数。
解码方法在 https://developers.facebook.com/docs/authentication/ 中进行了解释signed_request/ - 当您的应用程序加载到页面选项卡上时,您将获得“page”参数。

因此:

  1. 第一次将应用程序提供的选项卡加载到新页面上时,您可以从签名的请求中检测页面 ID。

  2. 此回调还会告诉您当前查看页面选项卡的用户是否是该页面的管理员(如果适用,这对您自己的编辑界面很有用)

  3. 如果您还没有一个界面,应用程序用户可以在其中告诉您他们管理您的哪些页面可以通过访问获得用户管理的所有页面的列表 在其用户对象(Graph API 中的 /me/accounts)上使用 'accounts' 属性。

[edit] I misunderstood your question and thought you had less implemented than you seem to have: If you have manage_pages permission for a user, you can get the Page access token for each of their pages, and access a list of apps currently installed as tabs on that page - the instructions are at https://developers.facebook.com/docs/reference/api/page/#tabs
[/edit]

Each request made to your app's 'page tab url' will include a signed_request parameter.
The method to decode it is explained at https://developers.facebook.com/docs/authentication/signed_request/ - when your app is loaded on a page tab you'll get the 'page' parameter.

So:

  1. The first time the tab provided by your app is loaded on a new page, you can detect the page ID from the signed request.

  2. This callback will also tell you if the user currently looking at the page tab is an admin of that page (which can be useful for your own edit interface, if applicable)

  3. If you haven't already got an interface where the app user tells you which pages they admin you can get a list of all the pages that user administers by accessing the 'accounts' property on their user object (/me/accounts in the Graph API) once you have the manage_pages permission

风追烟花雨 2024-12-08 10:39:24

您可以在您网站的数据库中跟踪谁拥有该应用程序的授权吗?

即从您的应用程序调用网站服务器上的脚本,该脚本返回用户是否已授权该应用程序。

can you keep track of who has the app authorized in a database on your website?

i.e. call a script on your website server from your app that returns whether or not the user has authorized the app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文