Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Rest API and Digest
  • I know it's probably something stupid on my part, but... I'm trying to create an REST api and I'm going to be using digest for authentication, but when testing the get function, I keep getting the "Authentication Required" popup (obviously I'm testing through a browser window and maybe that's my problem) and I'll enter my username and password, which is defined in the rest config file for 'valid_logins', and I'll be asked for authentication again, and again, and again... without ever getting to the data. I'm a noob with REST and FuelPHP so I know it's something stupid on my part. One more question, is it best practice to create several if statements to accommodate all the parameters in the request string? If not, what's a better way to do it. I was trying something like this:
    if( Input::get('param') )
    {
        $obj = $obj->where('param', Input::get('param')); 
        //of course done with checks and what not. This is just simplifying it
    }
    
    Thanks for the help. And I'm loving FuelPHP so far!
  • OK. I just tested and I still can't get digest to work. I thought cURL did the password encryption but maybe not. I'm using this to try and get the data:
    $curl = \Request::forge('http://example.com/path/to/api/method.xml?param=value', 'curl');
    $curl->http_login('username', 'password', 'digest')->execute();
    

    This works fine with 'basic' and no authentication, but for some reason I can't get it to work with digest. I know it must be something on my end but I can't figure out what. Any help would be greatly appreciated!
  • For anyone else struggling with using digest, check with your host to see if they support it. Mine didn't :( except on VPS\Dedicated servers. We're switching this to a dedicated server anyway, but it would have been nice to test it before moving everything. Oh well. I would still love a comment about best practice for dealing with options in the query string. Thanks!

Howdy, Stranger!

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

In this Discussion