Now I am developing a mobile web application using a connection to facebook, but I am having problems with the OAuth dialog. For my reference, I use the following documents on facebook:
http://developers.facebook.com/docs/guides/mobile/#web
I choose to use OAuth Dialog instead of the login button because mobile browsers do not recognize FBML (I use the Blackberry browser when testing). The OAuth dialog box also allows me to add a list of permissions within the scope settings. But the problem is that when I logged in using the OAuth Dialog, the $ me parameter was not recognized so that the login button was still displayed and did not change to the logout button. Here is an example of my code:
$facebook = new Facebook(array(
'appId' => 'xxxxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'cookie' => true,
));
$session = $facebook->getSession();
$me = null;
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
$accessToken = $facebook->getAccessToken();
} catch (FacebookApiException $e) {
error_log($e);
}
}
if ($me) {
echo "<img src=\"images/logoutFB.gif\">";
} else {
echo "<a href=\"http://www.facebook.com/dialog/oauth?scope=user_about_me,user_activities,user_birthday,user_education_history,user_events,user_groups,user_hometown,user_interests,user_likes&client_id=".$facebook->getAppId()."&redirect_uri=".urlencode("http://MYURL.COM")."&display=wap\"><img src=\"images/loginFB.gif\"></a>";
}
Can I use the $ me parameter if I use the OAuth dialog to connect to facebook? So, how do I know if I am already registered with facebook or not if I use OAuth Dialog? Please help if you have a solution.