Jeremy
Jeremy

Reputation: 179

How to determine if an app is authorized to a fan page

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:

Upvotes: 1

Views: 1271

Answers (2)

Igy
Igy

Reputation: 43816

[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

Upvotes: 1

jbuzzard
jbuzzard

Reputation: 1

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.

Upvotes: 0

Related Questions