40 thoughts on “Codeigniter, Ion Auth and Facebook Ion Auth – Tutorial

      1. First, thanks for this tutorial,I followed all steps that you have given.
        When I click on the login with facebook button, I will be redirected to the authentification interface of the facebook, I enter my email and my password, after that I have this message “MyApplication will receive the following info: ….”. I click Ok and I will be redirected to the root of codeigniter. Unfortunately, I will not be registred into the database 🙁

        1. Well…
          I’v tried it now logged out from FB… and it work perfectly!
          Do you have the right domain set up on FB?
          The table has the right fields?

          try some debugs on the SQL insert of ion auth model… etc…

        2. Please see what I have on my /application/controllers/frontpage.php… this controller is the one that handles with your root.

        3. I have the same issue. No data gets registered in to the database. I just get re-directed to header(‘Location:/?alert=facebooklogin’);

  1. This is an awesome tutorial. Though I have one question. I have multiple user groups in my application and the group option is selected during registration. How can I assign a user it’s group during registration/login with facebook? Thanks.

    1. I would use issset to check if the groups have been selected, if not redirect the user once logged in to a page that allows them to select the groups and then move them along to your home controller or wherever it is you would like them to go once logged in.

      Are the groups default groups? As in all new members are given the same group?

      If so you could just have your db assign a default value when populating the table, should the value have not been sent as part of registration.

  2. Hi quick question for you.

    What do you do with the call back code value you $_GET from the URL from facebook? did you store it? Also could you inform me how I can for example display the users name after they have logged in?

    Thank you. Great Tutorial helped a lot!

  3. Hi,

    I am using this code. However, I am facing two problems a) After executing the sql queries in ion_auth all my existing tables are being referred to as “users.[old table name]” and b) No data is being added in my database. Not sure if both are connected. Can you please let me know what you think?


  4. Hello sir. this code is awesome . however do you have a work around for the errors found on the facebook login page of my site and can I put active 1 on the users table so the people with facebook doesn’t need to register thru email anymore.


  5. The process works and facebook notes that the user is logged in. However, CI does not. when i check for sessions, CI still notes as anonymous and i am guesing this is because the user is not added to the database. Kindly walk me through how i can do this. am guesing the issues comes with ion_auth library?

  6. Hello you all!

    I will make a new installation of CI and do the process from the beginning and record it to update this post.

    tnk u all

    1. thank you. Waiting for the update. my config(ion_auth) seems to be set ok…including the model of course but no data gets to the DB. Must be missing something very minor…help out

  7. Hi,

    thank you very much for your tutorial !!

    i would like to implement that in my website but i don’t find “check if this user is already registered”. Where is it ? In the library ? in the controller ?

    Thanks for your reply 🙂


  8. I found it !! Sorry… i looked for in Ion Auth controller or Library and not in facebook ion auth…

  9. I have a question, the $user->username is null? I set up this aproach and I codeigniter told me that username is not define

  10. Hello, awesome tutorial. For some reason I can only get back Name and ID in the response object. I don’t believe login review is necessary to get email correct?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.