I am trying to get an access token using the latest SDK for PHP. As far as I know, I'm doing everything right, but when it redirects to facebook.com/oauth/dialog, it just has a white screen. My code is:
<div class="authorize_btn" style="float:right; margin-top:-35px; padding-right:10px">
<?php
include ('facebook/facebook.php');
$facebook = new Facebook(array( 'appId' => 'xxxxx',
'secret' => 'xxxx',
'cookie' => true ));
$session = $facebook->getUser();
$me = null;
if ($session) {
try {
$me = $facebook->api('/me');
}
catch (FacebookApiException $e) {
echo $e->getMessage();
}
}
if ($me) {
$logout = $facebook->getLogoutUrl();
echo "<button class='btn btn-primary'></button";
} else {
$login = $facebook->getLoginUrl();
echo "<a href='$login'>Authorize</a>";
}
?>
</div>
jsmos source
share