Hi,
I am in the process of devloping a facebook canvas application in php and FBML, and am having issues when it comes to setting up authorization for the application. I basicly do not kno how to go about it, or what the best method is.
I have been searching around on the internet most of the day but either stummble on old API things, or i dont know how to implement what they are explaining.
Here is what i have:
$facebook = new Facebook(array(
'appId' => '*snip*',
'secret' => '*snip*',
'cookie' => true,));
$session = $facebook->getSession();
$fbme = null;
if ($session) {
try {
$uid = $facebook->getUser();
$fbme = $facebook->api('/me');
} catch (FacebookApiException $e) {
d($e);
}
}
if (!$fbme) {
$loginUrl = $facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'req_perms' => "publish_stream,user_birthday,friends_birthday,user_events,user_hometown,friends_hometown,user_location,friends_location,offline_access,"
));;
}
if (isset($loginUrl)) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
But that does nothing, and if i try with changing the headers instead of using script block, i get:
The URL ... is not valid
Am i going about this all wrong?
Thanks in advance for any help.
Andy