Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2018 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/ecc18274438d807ef1f822b05a339fc4 to your computer and use it in GitHub Desktop.
Save anonymous/ecc18274438d807ef1f822b05a339fc4 to your computer and use it in GitHub Desktop.
Using Facebook Api Codeigniter
********************
Using Facebook Api Codeigniter >>>
********************
http://shurll.com/bz8zy
(Copy & Paste link)
********************
In Facebook when validation will be success it will respond back with accesstoken that will contain the users detail. tableName='users';$this->primaryKey='id';}publicfunctioncheckUser($data=array()){$this->db->select($this->primaryKey);$this->db->from($this->tableName);$this->db->where(array('oauthprovider'=>$data['oauthprovider'],'oauthuid'=>$data['oauthuid']));$prevQuery=$this->db->get();$prevCheck=$prevQuery->numrows();if($prevCheck>0){$prevResult=$prevQuery->rowarray();$data['modified']=date("Y-m-dH:i:s");$update=$this->db->update($this->tableName,$data,array('id'=>$prevResult['id']));$userID=$prevResult['id'];}else{$data['created']=date("Y-m-dH:i:s");$data['modified']=date("Y-m-dH:i:s");$insert=$this->db->insert($this->tableName,$data);$userID=$this->db->insertid();}return$userID?$userID:FALSE;}} Views (userauthentication/index.php) If the user already logged in with their Facebook account, this view will display the profile details, otherwise, Facebook login button will be shown. Categories Become an Instructor Udemy for Business Help Sign Up Log In . Thanks in advance Reply LUIS CLAUDIO ALVES GAMA says: May 22, 2016 at 8:48 am I use this function to post in groups. Now click on Add a New App. Menu Health & Fitness All Health & Fitness Fitness General Health Sports Nutrition Yoga Mental Health Dieting Self Defense Safety & First Aid Dance Meditation Other . libraries/facebook/vendor/autoload.php ); but folow the steps, we dont have this file. This is a awesome tutorial. can you provide link where i can faind facebook-php-sdk v5. i just edit the database setting, thats all. The coborff project was usefull too. application/libraries/facebook/facebook.php: ci =& getinstance(); // Initialize the SDK FacebookSession::setDefaultApplication( $this->ci->config->item('apiid', 'facebook'), $this->ci->config->item('appsecret', 'facebook') ); } /** * Get FB session. Reply Pablo says: December 8, 2014 at 11:01 pm Hey great tutorial. You need to specify the App Id, App Secret and redirect URLs according to your Facebook App credentials. please see my updated question. Step 7 :For going todashboard, click on Skip Quick start. Hi ,, thanks for his tutorial about facebook login on codeigniter. POST in REST3349What exactly is RESTful programming?355Design for Facebook authentication in an iOS app that also accesses a secured web service7Codeigniter and RestServer. I have created a Github repository with all the necessary integrations (and some extra stuff) Here is the link: Coborff I credited your tutorial on the Readme file, and if you wish I may add you as a contributor in case you wanna add stuff or just be recognized as part of the team hahah Have a nice day and stay awesome! Reply Rincy Renin says: May 19, 2016 at 3:51 am how to run composer install to download the required dependencies. //$redirectUrl = baseurl() . So. Reply prabakaran says: December 22, 2015 at 7:07 am nice tutorial Reply prateek says: January 27, 2016 at 4:50 am i am not getting all the information in my $data array. Stack Overflow works best with JavaScript enabled .. libraries/facebook/Facebook/autoload.php ); Also i got this error: Fatal error: Class FacebookFacebookSession not found in& Reply Ben Marshall says: January 30, 2015 at 10:22 am Be sure youre loading that class with: use FacebookFacebookSession; Reply Inigo says: December 30, 2014 at 8:43 am Does not work for me, FacebookSession does not exist. more stack exchange communities company blog Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Log In Sign Up . 'libraries/facebook/vendor/autoload.php' ); Because you didnt explain that where autoload.php is replaced. Hi, thank you for awsome tutorial, but I have a problem implementing, I got error message: A PHP Error was encountered Severity: 8192 Message: Function mcryptcreateiv() is deprecated Filename: PseudoRandomString/McryptPseudoRandomStringGenerator.php I used php version 7.1.4, how to fix this error? thank you July 4, 2017 at 11:00 AM CodexWorld Said. It's back! Take the 2018 Developer Survey today . if your function is fbpost() and the callback url is the same, and the callback is a GET request, it won't work. #main{ width:960px; margin:50px auto; font-family:raleway; } h2{ position: relative; background-color: #26c489; text-align:center; border-radius: 10px 10px 0 0; margin: -10px -40px; padding: 30px; color:white; } hr{ border:0; border-bottom:1px solid #ccc; margin: 10px -40px; margin-bottom: 30px; } #login{ width:462px; float: left; border-radius: 10px; font-family:raleway; border: 2px solid #ccc; padding: 10px 40px 34px; margin-top: 0; margin-left: -70px;; background-color: #DBF6ED; } img.fb{ height: 50px; padding-left: 90px; } img.fbprofile{ height: 50px; padding-right: 20px; margin-left: -410px; } p.profilename{ font-size: 16px; margin-top: -19px; margin-left: -148px; } a.logout{ position: absolute; font-size: 18px; text-decoration: none; top: 46px; right: 45px; } Conclusion: This was all about how we canimplement Facebook open authentication with our website using CodeIgniter. I was getting the vendor error and Ive fixed changing requireonce( APPPATH . All rights reserved. i.e. Reply Tori says: December 1, 2014 at 4:06 am i loged in fb and accept app. Had to install it in the application/libraries/facebook folder. Thats why I was getting the error that I was declaring 2 Facebook libraries. Thanks April 5, 2017 at 5:06 AM Rama Aju Said. Step 8:In Dashboard you will see your App IDandApp Secret.Where App IDis visible and App Secret key is hidden, to see this click on show button, nowthat App IDandApp Secret Key you have to add into your application code as shown below: // Load facebook library and pass associative array which contains appId and secret key $this->load->library('facebook', array('appId' => ' ', 'secret' => ' ')); ThisApp IDandApp Secret is only accessible by your own Facebook account, by default it is available forprivate, but for making public, click on settings link and followstep 9 &10. 3. Take a look on files structure of Login with Facebook in CodeIgniter using PHP SDK v5 5a02188284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment