HttpSocket - need to logout after digest login


#1

CakePHP 2.x I’m using HttpSocket digest to login - working great. Is there a method for logging out?


#2

There is no way to logout since digest auth is stateless


#3

Hi there, I’m trying to implement HTTP Digest Authentication, but I’m having troubles to login over the Web Service that supports Digest. I always get Unauthorized from the server. Could you publish your implementation please?

This is what i got in the client;

        $http = new HttpSocket();
        $http->configAuth('Digest', array(
            'user' => 'myUser',
            'pass' => '22da9adc05daf39df4d813d9ac227337',
        ));

        $q = $http->post(
                $url, json_encode($data)
        );

And this is what i got at appController.php in the webservice side;

public $components = array(
    'Session',
    'RequestHandler',
    'Security' => array(
    //'blackHoleCallback' => 'forceSSL'
    ),
    'Auth' => array(
        'authenticate' => array(
            'Digest' => array(
                'userModel' => 'User',
                'fields' => array('username' => 'username', 'password' => 'digest_hash')
            )
        ),
    //'authorize' => 'Controller'
    )
);

When I access the webservice url locally it prompts me for username and password and I put it and it works, it gives me access, but when I do it via HTTP it prevents me

Regards…