Hi,

I have one dev application running like this:

class IndexController extends Zend_Controller_Action
{
        protected $fb = null;
        protected $fb_apikey = "apikey";
        protected $fb_secret = "secret";
        protected $fb_callbackurl = "http://www.myfacebookapp_domain.com/";;
        protected $fb_appurl = "http://apps.facebook.com/my_app_in_facebook/";;

        protected $app_path = "/home/_applications/my_app/";
        protected $user = 0;

    public function init()
    {
        $this->_initFacebook();
    }

    public function indexAction()
    {
        // start doing your own stuff
    }

    protected function _initFacebook()
    {
        require_once "/home/_library/facebook-platform/client/facebook.php";

        $this->fb = new Facebook($this->fb_apikey, $this->fb_secret);

        $this->user = $this->fb->require_login();

        //catch the exception that gets thrown if the cookie has an invalid
session_key in it
        try
        {
                if (!$this->fb->api_client->users_isAppAdded())
                {
                        $this->fb->redirect($this->fb->get_add_url());
                        }
        }
                catch (Exception $ex)
                {
                        //this will clear cookies for your application and 
redirect them to a
login prompt
                        $this->fb->set_user(null, null);

                        $this->fb->redirect($this->fb_callbackurl);
                }
    }
}

br, Marko

-- 
View this message in context: 
http://www.nabble.com/Facebook-Integration-tp22407798p22409735.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to