Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Facebook Auth_Opauth
  • Hi,

    Have a small issue trying to create a facebook login : My callback is called right, (took the same as the doc say) but the problem is that an exception is thrown in the login_or_register() Auth_Opauth method.

    I think I know why : The facebook answer to the callback contain a GET variable to return data whose name is 'code'. I looked in the Auth_Opauth and the callback method contain this : 

    // fetch the response and decode it
    $this->response = \Input::get('opauth', false) and $this->response = unserialize(base64_decode($this->response));

    So basically it look at Input::get('opauth', false) but in order to work it should be Input::get('code', false)

    The problem come from my setup, or it's a change in facebook or something ?

    Thanks in advance
  • HarroHarro
    Accepted Answer
    The response from Facebook should be picked up by the opauth driver, which processes the facebook specific return values, and converts them into a standardized response. It then redirects and passes the info back to the Fuel driver using the GET variable 'opauth'.

    If you check the int_callback() method of the Facebook strategy driver, you will see it will use $_GET['code'] and converts it.

    Your callback method, the one that facebook redirects too after login, should contain:

                // get the Opauth object
                $opauth = \Auth_Opauth::forge(false);

                // whatever happens, we're sending somebody somewhere
                $status = $opauth->login_or_register();

    And it is that first line of code that handles the callback, and calls the Opauth facebook driver to unify the result and return it through a redirect. To do that, it uses this code:

                    $this->redirect($this->env['callback_url'].'?'.http_build_query(array('opauth' => base64_encode(serialize($data))), '', '&'));

    So if your code follows the example (which comes from our own cms framework) you may need to verify your opauth configuration, because it seems either the facebook or the opauth redirect gets to the wrong place.
  • Ok, I reinstalled Opauth and Opauth-facebook, it work now. '-_-

    Thanks

Howdy, Stranger!

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

In this Discussion