# HttpSocket - need to logout after digest login

**URL:** <https://discourse.cakephp.org/t/httpsocket-need-to-logout-after-digest-login/2848>\
**Category:** Need Help\
**Created:** [July 6, 2017, 5:07pm UTC](https://discourse.cakephp.org/t/httpsocket-need-to-logout-after-digest-login/2848 "2017-07-06T17:07:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![radarhill](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/radarhill/32/704_2.png) [@radarhill](https://discourse.cakephp.org/u/radarhill)\
**Post date:** [July 6, 2017, 5:07pm UTC](https://discourse.cakephp.org/t/httpsocket-need-to-logout-after-digest-login/2848/1 "2017-07-06T17:07:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![heywhy](https://avatars.discourse-cdn.com/v4/letter/h/bc8723/32.png) [@heywhy](https://discourse.cakephp.org/u/heywhy)\
**Post date:** [July 6, 2017, 9:23pm UTC](https://discourse.cakephp.org/t/httpsocket-need-to-logout-after-digest-login/2848/2 "2017-07-06T21:23:51Z")

</div>

There is no way to logout since digest auth is stateless

---

<div class="post-metadata">

**Author:** ![suarezl.1w](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@suarezl.1w](https://discourse.cakephp.org/u/suarezl.1w)\
**Post date:** [August 27, 2017, 9:47pm UTC](https://discourse.cakephp.org/t/httpsocket-need-to-logout-after-digest-login/2848/3 "2017-08-27T21:47:33Z")

</div>

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…
