Love Fuel?    Donate

FuelPHP Forums

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

    I try to etablish an Opauth facebook connect for a website. I done this before several time without problem, but it's been a long time, I forgot how it works... So this time, when facebook redirect to the callback, I get this :

    image
    Beside, The callback url is http://example.com/public/opauth/signup/facebook/int_callback?code=[...] instead of http://example.com/public/opauth/callback/[...] which is my callback method. Where do I change that ?

    Thanks.


  • Are you using Opauth directly, or are you using Auth's Opauth integration?

    To change the callback, you have to login to the facebook developer website, select your app from the "My apps" dropdown, and then on the left select the "Settings" tab. The callback URL is defined under Website Site URL.
  • I'm using Opauth integration with Simpleauth.

    I looked very carefully at the setting tab, there is nothing under the Website url field. In "advanced", I have a field for whitelisted callbacks but that's all. Are you sure the callback is not set in Opauth config and sent to facebook in uri params ?

    Thanks 
  • HarroHarro
    Accepted Answer
    I'm not an Opauth expert, I can only say how it is implemented in the app here. We only have one client app that has Facebook integration.

    The Fuel Opauth class does allow a callback_url to be defined in the config that is passed to the class. If not present, it will try to construct one based on the path information in the config. This is the code that does that:

            // and construct the callback URL if needed
            if (empty($config['callback_url']))
            {
                // pop the method name from the path
                $path = explode('/', trim($config['path'], '/'));
                array_pop($path);

                // and add 'callback' as the controller callback action
                $config['callback_url'] = (empty($path)?'':'/'.implode('/', $path)).'/callback/';
            }

    This expects a path in the form "/this/is/some/controller/method". It will strip the last element, and replace it with "callback" so it becomes "/this/is/some/controller/callback".

    Obviously this won't work if your path contains additional segments, your callback method isn't in the same controller as your login method, or your URL contains additional parameter segments. In these cases you will have to pass your custom url to Opauth in the config ( an optional conffig array is the first parameter of Opauth::forge() ).

Howdy, Stranger!

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

In this Discussion