CakePHP Facebook Plugin redirection problem
I have implemented Nick's Facebook Plugin.
Have Imported the Facebook Helper and Connect Component in the app_controller. Changed the Html accordingly.
app_controller.php
<?php
class AppController extends Controller {
var $components = array('Session', 'Facebook.Connect' => array('createUser' => false), 'Auth');
function beforeFilter() {
$this->Auth->allow('*');
$this->set('fbuser',$this->Connect->user());
}
function beforeFacebookSave() {
}
function beforeFacebookLogin($user) {
//Logic to happen before a facebook login
}
function afterFacebookLogin() {
//Logic to happen after successful facebook login.
}
}
?>
in the home.ctp
<?php
if($fbuser)开发者_高级运维 {
echo $this->Facebook->logout();
debug($fbuser);
} else {
echo $this->Facebook->login();
}
?>
Once i click login and allow the permissions. it keeps refreshing indefinitely :(
My App settings online
Am on Windows Machine and access the code with this base http://localhost/spider/
i also set the canvas url as follows
I think its because of the configuration on the application settings online. Nick in the Video visits localhost.localdomain/websites/facebook_example to access the code. What is the need of the ".localdomain"
I had the same problem, and I found the answer here:
http://ardentdev.com/no-facebook-connect-cookies-for-localhost-development/
While doing some Facebook Connect development, I found that the expected cookies were not being set when developing on localhost. To fix the problem, I added localhost.local to my hosts file (pointing at 127.0.0.1) and changed the settings for my Facebook application to use localhost.local as the base domain.
精彩评论