getLogoutUrl using facebook graph api php CodeIgniter -


i following http://benmarshall.me/facebook-sdk-php-v4-codeigniter/ tutorial. here can login url can not logout url can tell me why not getting this

here facebook libaray logout function

 public function logout_url() {         $_session = $this->helper->getsessionfromredirect();         $session = new facebooksession( $_session->gettoken() );         $next_url = 'http://localhost/ci_sdk/index.php/welcome/login';         return $this->helper->getlogouturl($session,$next_url);                } 

here constructor in facebook library

  public function __construct() {     $this->ci =& get_instance();     $this->permissions = $this->ci->config->item('permissions', 'facebook');      facebooksession::setdefaultapplication( $this->ci->config->item('api_id', 'facebook'), $this->ci->config->item('app_secret', 'facebook') );       $this->helper = new facebookredirectloginhelper( $this->ci->config->item('redirect_url', 'facebook') );      if ( $this->ci->session->userdata('fb_token') ) {       $this->session = new facebooksession( $this->ci->session->userdata('fb_token') );        try {         if ( ! $this->session->validate() ) {           $this->session = null;         }       } catch ( exception $e ) {         // catch exceptions         $this->session = null;       }     } else {        try {         $this->session = $this->helper->getsessionfromredirect();       } catch( facebookrequestexception $ex ) {        } catch( exception $ex ) {        }     }      if ( $this->session ) {       $this->ci->session->set_userdata( 'fb_token', $this->session->gettoken() );        $this->session = new facebooksession( $this->session->gettoken() );         $this->logouturl = $this->helper->getlogouturl( $this->session, 'http://localhost/ci_sdk/index.php/welcome/login' );     }   } 

here controller function

public function logout()     {         $this->load->library('facebook');         $logout_url = $this->facebook->logout_url();         echo '<a href="' . $logout_url . '">logout</a>';      } 

it giving me errors

fatal error: call member function gettoken() on null in e:\xammp\htdocs\ci_sdk\application\libraries\facebook\facebook.php 

i new codeigniter kindly me. in advance


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -