All pastes #758987 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-02 19:04 UTC
rendered paste body
		$facebook = new Facebook(sfConfig::get('app_facebook_key'), sfConfig::get('app_facebook_secret'));
		
		$facebook_id = $facebook->require_login();
	
		//[todo: change the following url to your callback url]
		$appcallbackurl = sfconfig::get('app_facebook_canvas_page');  

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