I've got an iframe loading in a facebook tab on a fan page and I'm not having any luck accessing the $_REQUEST["signed_request"] object. I'm confused because this is supposed to be a freebie and easily accessible. I've read and re-read the facebook docs and rechecked my facebook application settings but nothing is working.
isset($_REQUEST['signed_request']
is always false. Since I'm using the Facebook PHP sdk I've also tried
$facebook->getSignedRequest();
I've done print_r on the $_REQUEST and I don't see the signed_request in there. When I print_f the $facebook object, I see that the signedRequest is empty
[appId:protected] => XXX
[apiSecret:protected] => XXXXXXXXXXXXXXXXXXXX
[session:protected] => Array
[access_token] => XXXXXXXXXX|2.h75WqKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374|JiO0ZS30SyLaApeqhMtdocK8B_Y
[base_domain] => XXXXXXXXX
[expires] => 1304452800
[secret] => rDF9C_z43_EUFy0Q_e6tyQ__
[session_key] => 2.h75W开发者_Python百科qKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374
[sig] => 1971ef7eb8057c7404eae1f82d770ab5
[uid] => XXXXXXXXXXXXXXX
[signedRequest:protected] =>
[sessionLoaded:protected] => 1
[cookieSupport:protected] => 1
[baseDomain:protected] =>
[fileUploadSupport:protected] =>
[EDIT] I do have the OAuth 2.0 setting enabled for the application.
OK, just had this on problem myself and found the issue.
Make sure that you do not have a 301 redirect on the canvas or tab page. In my case I set the app up as "mydomain.com/facebook/tab/" but my site was doing a 301 to "www.mydomain.com/facebook/tab/"
The content would show, bit the 301 caused the signedRequest to be null.
Added "www" to my domain in the app settings and the signedRequest now contains the data I was looking for.
I just had this problem. Finally figured it out. I had to add a forward slash to the end of my Tab URLs in the application settings on the Basic tab.
Instead of: http://domain.com/facebook
I needed: http://domain.com/facebook/
I had the same problem And I resolve it. It's a problem with the URLS. Be sure that your App Domain & Page Tab URL match the same domain for example:
1) App domain: example.com Page Tab URL: example.com will work
2) App domain: example.com Page Tab URL: example.com/app/ will work
3) App domain: fb.example.com Page Tab URL: fb.example.com/app/ will work
4) App domain: fb.example.com Page Tab URL: example.com/fb will not work
After some investigation, I suspect this has something to do with where the iframe source is hosted.
When I moved everything to localhost, the signed_request started coming in fine.
Edit the settings of your tab application. On "Advanced" tab, make sure "OAuth 2.0 for Canvas" is enabled.
it's an old question but I found this with google... the problem for me was that I did a manual redirect to the https url of my pagetab and than the $_POST['signed_request'] got lost
精彩评论