tags:

views:

131

answers:

2

Hello, i've run into a problem.

I have custom page tab, and current user viewing on it. I ask user to grant extended permissions to his profile (using Facebook.showPermissionDialog). If he grants permissions, theoretically, i would have access to the Graph API and other stuff. But when i parse new signed_request param from Facebook, i get oauth_token, bound to current page tab, not to user profile. In other words request to Graph API method 'me' gives me my custom page profile. And I want to get user's profile! How should i get access to it?

How to get access to user's Graph API on Facebook tab?

+1  A: 

Tab is much more limited than a regular app. It doesn't know who is visiting it unless they interact with the tab. Basically it was made to emphasize that a tab is designed to be useful to a user who installed it, not to visitors. From docs:

  • It doesn't know who the viewing user is when the user first visits the tab. Facebook sends the fb_sig_user and fb_sig_profile_user parameters, both containing the profile owner's user ID.
  • If a viewing user interacts with the tab (like submits a form, takes an action that causes an AJAX load of new content, or follows a relative URL that loads on the tab), that user's UID is sent to the application as the fb_sig_user parameter, the profile owner's user ID is sent as the fb_sig_profile_user parameter. The viewing user's session key is key is sent only if the user authorized the application.
  • Applications use the owner's session key on the owner's application tabs.
serg
+1  A: 

I've figured out how it works. After the user grants permissions, Facebook sends signed_request of current user (and his ID as well), when calling page on my server via Ajax. When the page loads statically - you get signed_request of page tab. Hope it will help somebody.

Andrew
how to parse/decode payload back to json object?
cdpnet
could you, please, explain more detailed? Is it possible to fetch UID of user who is viewing an other user tab?
balepc

related questions