I am trying to integrate facebook SDK with a codeigniter website. I have used composer to install the files with the composer.json file with the code provided in the facebook documentation. I have looked at multiple other potentially similar problems on stackoverflow and around and came across examples like this:
http://metah.ch/blog/2014/05/facebook-sdk-4-0-0-for-php-a-working-sample-to-get-started/#post-937 CodeIgniter Facebook SDK 4 with Composer Error: Class 'Facebook\FacebookSession' not found with the facebook PHP SDK
The error I recieve is:
Fatal error: Uncaught exception 'Facebook\FacebookSDKException' with message 'You must provide or set a default application id.' in ....
I have the following code in my controller:
public function login()
{
$fb_config = array(
'appId' => 'xxxxx',
'secret' => 'xxxx'
);
$this->load->library('facebook', $fb_config);
$user = $this->facebook->getUser();
if ($user) {
try {
$data['user_profile'] = $this->facebook
->api('/me');
} catch (FacebookApiException $e) {
$user = null;
}
}
if ($user) {
$data['logout_url'] = $this->facebook
->getLogoutUrl();
} else {
$data['login_url'] = $this->facebook
->getLoginUrl();
}
$this->load->view('templates/header');
$this->load->view('user/login',$data);
}
I have tried adding require and use and session start at the top of the class but the issue persists.