The Facebook Auth Dialog won't show up when viewing the app in a page tab (iframe). It works fine when viewing the app externaly though.
My Facebook app settings are:
Site URL: http://domain.com/test
Canvas URL: http://domain.com/test/
Secure Canvas URL: https://domain.com/test/
Page Tab URL: http://domain.com/test/
Secure Page Tab URL: https://domain.com/test/
I've added the app to the page tab ny using the link: https://www.facebook.com/dialog/pagetab?app_id=[MY_APP_ID]&next=https://domain.com/test/
I'm using the php sdk. And my code in //domain.com/test/index.php looks like this:
<?php
require 'facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => '[MY_APP_ID]',
'secret' => '[MY_APP_SECRET]',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Facebook test</title>
</head>
<body>
<p>
<?php if($user) : ?>
<a href="<?php echo $logoutUrl;?>">Logout</a>
<?php else: ?>
<a href="<?php echo $loginUrl;?>">Login</a>
<?php endif; ?>
</p>
</body>
</html>
Would be grateful for any help!!