1

I'm trying to do Facebook Login in my Codeigniter function. I set configs and redirected to permission page also i got the permission from user and finally redirected page to again this function but still getUser() function is returning 0. What is the problem here? Can anybody help? My codes here;

public function facebook_uye() {
    $fb_config = array(
        'appId' => 'xxxxx',
        'secret' => 'xxxxxxxxxxxxxxx'
    );

    $this->load->library('facebook', $fb_config);
    $user = $this->facebook->getUser();

    if ($user) {
        try {
            $user_profile = $this->facebook->api('/me');
        } catch (FacebookApiException $e) {
            error_log($e);
            $user = null;
        }
        print_r($user_profile);
    } else {
        $url = "https://graph.facebook.com/oauth/authorize?client_id=xxxxxxx&redirect_uri=http://www.blahblah.com/&scope=email";
        echo "<script language=javascript>window.open('$url', '_parent', '')</script>";
    }

}

Onur Sevik
  • 75
  • 1
  • 8

0 Answers0