TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
FacebookAuth module for Kohana 3.2
  • Hi!

    I just updated my (first) module for Kohana 3.2, called "FacebookAuth". If u want to implement facebook login, use it!

    Link: https://github.com/mobal/kohana-facebookauth-module

    Modified facebook.php (Facebook SDK), now using Kohana's Session manager!

    Waiting for feedback! Bugreport, ideas etc.

    Thanks!

    mobal,

  • Your documentation has a typo :P

    if($fb->logged_in()) {
        echo $fb->get('email);
    } else {
        Request::current()->redirect($fb->login_url());
    }

    Request::current() not Request::curren()

  • Yes! Thanks for help @MasterGberry

  • Updated, some comment, typo fixed.

  • Does this module support registration using facebook? I will probably eventually design a module that allows you to register on the kohana framework using google, yahoo, windows live, and facebook

  • I think yes. When you register with facebook, u check that the user is available in facebooks database. If yes, u copy the user id, name, email, etc. after next time login you will check only the ids - both available in your and facebooks database. With this method.

    mobal,

  • What about logout? Just redirect to $fb->logout_url() doesn't clear session data as I see. So, after Request::current()->redirect($fb->logout_url()); the $fb->logged_in() returns TRUE. What do I do wrong?

  • Igreh:

    You need to redirect back yourself. The Facebook app's settings are correct?

  • I don't understand what does "redirect back" mean in this situation, but I do the following: 1. Logout using native auth module 2. SESSION::instance()->destroy(); // to remove all session's data associated with facebook 3. $fb = FacebookAuth::factory(); Request::current()->redirect($fb->logout_url());

    Facebook settings seem to be correct, because it works fine

  • @mobal Awsome! Thank you for posting!

  • @Igreh than i don't know what is the problem. It works for me fine. Maybe a little "bug" in the machine? You need to redirect yourself to the "logout page".

  • I was just going to create a wrapper for facebook api in kohana way. Good thing there is already one. Zombor's one is 2 years old, and this one looks very good. Idk if some1 from the kohana development team can check the code and improve it if some parts need to. Thanks @mobal for sharing!! Good job!

  • I wonder... how to get the appId from the FacebookAuth object? I think we should implement a function to get properties from the fb object itself. This way we could do fb->method('appId') instead of doing Kohana::$config->load('facebook')->get('appId').

    What do u think ?

  • Don't you need to have the appID in order to interact with the Facebook app in the first place?

    Personally, I think the Kohana::$config->load('file.key') is already very handy. I like the consistency of loading configs in that way.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion