Skip to main content

Posts

Showing posts with the label iframe-app

facebook iframe app; php sdk getUser() returns valid id on page one but not for any other page

I have a facebook iframe app which correctly logs in and authorizes the app, but getUser() only works on the first page. As soon as a user clicks a link to a new page within the iframe, getUser() returns 0. What's strange is that this same code works for another app... I do all the clicking I want and getUser() returns a valid ID. The app that doesn't work: https://apps.facebook.com/celestial_glory/ The one that does (same codebase): https://apps.facebook.com/uprisingstlouis/ Here's the code I am using: require_once ('fb/facebook.php'); // snip... set $app_id, $secret, and $canvas_page // first, try normal facebook getUser(). If that works, awesome. $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $secret, )); $signed_request = $_REQUEST['signed_request']; // Get User ID $user = $facebook->getUser(); if ($user != '0') return 'fb=' . $user; // works once // getUser() didn't work. Try