Take the 2-minute tour ×

I'm developing a Facebook iframe/Facebook Connect application with PHP client library. In my index page, I check if the user is logged in by using require_login().

 $user_id = $facebook->require_login($required_permissions = 'user_location,publish_stream,email,read_stream,user_about_me,user_activities,user_birthday,user_events,user_groups,


Thus I get the $user_id of the user in that page. But in the subsequent pages, If I use require_login() to get the user_id, some prablem occurs and the page ie not redirected. The page gets refreshing and nothing is displayed.

So I tried using $user_id = $facebook->get_loggedin_user(); but then I dont get the user id in the variable.

If I use $user_id = $_GET[fb_sig_user]; , sometimes I get the value, sometimes I dont. Please suggest me the proper method to get the user_id in other pages too.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I have found the answer. Posting it so that it might help someone else ..

Adding $facebook->require_frame(); before using the $user_id = $facebook->require_login() syntax in the main page and the $user_id = $facebook->get_loggedin_user(); in the other pages, solves the problem.

For more details refer to this thread: http://forum.developers.facebook.com/viewtopic.php?pid=218858

share|improve this answer
that link is dead. –  Nate Nov 30 '12 at 1:09

Your Answer


