# Setup an HTTP to Authenticate over Digest Server

**URL:** <https://discourse.cakephp.org/t/setup-an-http-to-authenticate-over-digest-server/3100>\
**Category:** Need Help\
**Created:** [August 27, 2017, 9:51pm UTC](https://discourse.cakephp.org/t/setup-an-http-to-authenticate-over-digest-server/3100 "2017-08-27T21:51:56Z")\
**Posts on this page:** 1\
**Page:** 1

<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:51pm UTC](https://discourse.cakephp.org/t/setup-an-http-to-authenticate-over-digest-server/3100/1 "2017-08-27T21:51:56Z")

</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.

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…
