0

I wonder if someone can answer this;

I have a canvas app, which in turn allows the user of the app to attach another app into their page tab. Everything works great. The page tab is now running from the users account. If a 'Viewer' interacts with that app on the users page tab, i know I cannot get their user id, but how can I get the actual URL of that page they are on, so I can update Pinterest for the 'Viewer'. Some people state that I need to access the signed request and some say the graph for the Page ID. Which one is the correct way to get the Page ID, or does it even matter ?

Thank you

user984689
  • 137
  • 1
  • 1
  • 13
  • Can you elaborate a bit more? – Nitzan Tomer Feb 17 '12 at 17:53
  • From the answer below I guess there is no right or wrong method to use. I just am having a problem getting the signed_request. Related articles state its a redirection problem, but my app settings are correct. – user984689 Feb 17 '12 at 18:01

1 Answers1

0

Take in account that your app always will receive the signed_request var from FB. So why don't use it? Using php-sdk you can obtain it like this:

$signed_request = $facebook->getSignedRequest();

// so for the page ID you do:
$page_id = $signed_request['page']['id'];
Igor Parra
  • 10,214
  • 10
  • 69
  • 101
  • May I ask, do I need more code for that to work? I keep using a similar version of your code, and it keeps coming up blank when trying to access the signed_request – user984689 Feb 17 '12 at 17:59
  • See the USAGE section in the [php-sdk](https://github.com/facebook/php-sdk) (Facebook PHP SDK (v.3.1.1)). It's quite easy. When you had instantiated the facebook class you can do the same as showed. Cheers! – Igor Parra Feb 17 '12 at 18:02
  • Here is a [related answer to signed_request](http://stackoverflow.com/a/9009619/333061). See at picture as you can use firebug to check/touch/see/smell the `signed_request` var arriving to your app! – Igor Parra Feb 17 '12 at 18:11