# Wowza Streaming Engine Digest Auth not working

**URL:** https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642
**Category:** Wowza Streaming Engine
**Created:** [February 12, 2020, 12:07pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642 "2020-02-12T12:07:07Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Andrei\_Lucaci](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Andrei\_Lucaci](https://community.wowza.com/u/Andrei_Lucaci)
#### Post date: [February 12, 2020, 12:07pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/1 "2020-02-12T12:07:07Z")

</div>

Hi all,

I have an issue.

I’m having a php backend that interacts with Wowza Streaming Engine REST Api.

I’m using the WOWZA rest api to connect: [https://github.com/WowzaMediaSystems/wse-rest-library-php](https://github.com/WowzaMediaSystems/wse-rest-library-php)  
and also using their example. The wowza auth digest doesn’t work (the default auth), and I don’t know why.

I’m having everything set up: the users in the file, the method set up correctly, yet the server says that I don’t have credentials.

This is the response:

JSON REQUEST to [http://localhost:8087/v2/servers/](http://localhost:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/{MY\_APP}/instances with verb GET: {“restURI”:“[http://localhost:8087/v2/servers/](http://localhost:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/{MY\_APP}/instances”,“settings”:{}} RETURN: {“message”:“The request requires user authentication”,“success”:false,“wowzaServer”:“4.7.7”,“code”:“401”} {“message”:“The request requires user authentication”,“success”:false,“wowzaServer”:“4.7.7”,“code”:“401”}

My question is this: why is this not working?

Server.xml

```auto
<RESTInterface>
  <Enable>true</Enable>
  <IPAddress>*</IPAddress>
  <Port>8087</Port>
  <!-- none, basic, digest-->
  <AuthenticationMethod>digest</AuthenticationMethod>
  <DiagnosticURLEnable>true</DiagnosticURLEnable>
  <SSLConfig>
    <Enable>false</Enable>
    <KeyStorePath></KeyStorePath>
    <KeyStorePassword></KeyStorePassword>
    <KeyStoreType>JKS</KeyStoreType>
    <SSLProtocol>TLS</SSLProtocol>
    <Algorithm>SunX509</Algorithm>
    <CipherSuites></CipherSuites>
    <Protocols></Protocols>
  </SSLConfig>
  <IPWhiteList>*</IPWhiteList>
  <IPBlackList></IPBlackList>
  <EnableXMLFile>false</EnableXMLFile>
  <DocumentationServerEnable>true</DocumentationServerEnable>
  <DocumentationServerPort>8089</DocumentationServerPort>
  <!-- none, basic, digest-->
  <DocumentationServerAuthenticationMethod>basic</DocumentationServerAuthenticationMethod>
  <Properties>
  </Properties>
</RESTInterface>		

```

Users are saved in /conf/admin.password

What am I missing? The credentials are correct, because if I switch to basic auth, and call the server with http://{username}:{password}@localhost… works. The issue with the basic auth is that the WEB ui doesn’t work with that auth, so I’m left with either none as auth, or digest, and digest doesn’t work with the library.

Thanks,

Andrei

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [February 12, 2020, 2:42pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/2 "2020-02-12T14:42:17Z")

</div>

Plain text user/password? Or did you hash them?

---

<div class="post-metadata">

### Author: ![Andrei\_Lucaci](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Andrei\_Lucaci](https://community.wowza.com/u/Andrei_Lucaci)
#### Post date: [February 12, 2020, 2:43pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/3 "2020-02-12T14:43:58Z")

</div>

Everything is plain.

Should I have hashed the credentials (MD5)?

Also, on basic auth, it’s still plain text e.g. [http://admin:admin@localhost:8087/](http://admin:admin@localhost:8087/)…

Kr,

Andrei

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [February 12, 2020, 2:46pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/4 "2020-02-12T14:46:27Z")

</div>

Not necessarily, just trying to make sure you aren’t trying to do digest auth vs. digest HTTP auth on accident. Subtle differences! [https://www.wowza.com/docs/how-to-change-the-authentication-method-for-the-wowza-streaming-engine-rest-api](https://www.wowza.com/docs/how-to-change-the-authentication-method-for-the-wowza-streaming-engine-rest-api)

I’ll look closer into this see if I can figure out what’s going on.

---

<div class="post-metadata">

### Author: ![Andrei\_Lucaci](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Andrei\_Lucaci](https://community.wowza.com/u/Andrei_Lucaci)
#### Post date: [February 12, 2020, 2:51pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/5 "2020-02-12T14:51:29Z")

</div>

Hi Amara,

Yes, I have read the docs so many times now, but it’s not that 🙂

The php code that actually does the request to the server is the one from the official REST API:

```auto
$ch = curl_init($restURL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $verbType);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);

if ($this->settings->isUseDigest()) {
    curl_setopt($ch, CURLOPT_USERPWD,
        $this->settings->getUsername() . ':' . $this->settings->getPassword());
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
}

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Accept:application/json; charset=utf-8',
    'Content-type:application/json; charset=utf-8',
    'Content-Length: ' . strlen($json),
]);
$contents = curl_exec($ch);
curl_close($ch);

```

That’s (I suppose) the equivalent of the command line cUrl:

```auto
curl --digest -u "username:password" ...

```

You can also look here [http://community.wowza.com/community/questions/7747/user-authentication-problem-via-curl-command.html](http://community.wowza.com/community/questions/7747/user-authentication-problem-via-curl-command.html) for an example (it’s the same used).

Thanks,

Kr,

Andrei

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [February 12, 2020, 3:21pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/6 "2020-02-12T15:21:18Z")

</div>

What kind of characters are in your passwords? Can you try really basic username/password combinations? I’m wondering if there is an encoding issue.

---

<div class="post-metadata">

### Author: ![Andrei\_Lucaci](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Andrei\_Lucaci](https://community.wowza.com/u/Andrei_Lucaci)
#### Post date: [February 12, 2020, 3:23pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/7 "2020-02-12T15:23:33Z")

</div>

The pass has no special characters, just plain letters and numbers. I have tried with all accounts, and some accounts with generic passwords, and still, no success.

Kr,

Andrei

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [February 12, 2020, 3:57pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/8 "2020-02-12T15:57:58Z")

</div>

Using curl the only way I’m seeing 401 unauthorized is if I have my auth set to something other than digest. Did you restart your server after making your server.xml changes?

---

<div class="post-metadata">

### Author: ![Andrei\_Lucaci](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Andrei\_Lucaci](https://community.wowza.com/u/Andrei_Lucaci)
#### Post date: [February 12, 2020, 4:05pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/9 "2020-02-12T16:05:45Z")

</div>

Yes, I have restarted it everytime. Changing auth from none to basic to digest works when restarting the service.

The only issue is that with digest option selected, I get the above mentioned result.

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [February 14, 2020, 4:13am UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/10 "2020-02-14T04:13:39Z")

</div>

Working with tech support to try to get you a better answer. They suggested looking at the readme to see the config.php example - [https://github.com/WowzaMediaSystems/wse-rest-library-php](https://github.com/WowzaMediaSystems/wse-rest-library-php)

Have you tried that for setting your username and password?

---

<div class="post-metadata">

### Author: ![Andrei\_Lucaci](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Andrei\_Lucaci](https://community.wowza.com/u/Andrei_Lucaci)
#### Post date: [February 14, 2020, 2:28pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/11 "2020-02-14T14:28:04Z")

</div>

Hi

I did, I’ll paste my config here, but everything is being set up. I’ve replaced my real credentials with dummy ones for this example.

```auto
<?php

define("WOWZA_HOST", "http://localhost:8087/v2");
define("WOWZA_SERVER_INSTANCE", "_defaultServer_");
define("WOWZA_VHOST_INSTANCE", "_defaultVHost_");
define("WOWZA_USERNAME", "{MY_USER}");
define("WOWZA_PASSWORD", "{MY_PASSWORD}");

// It is simple to create a setup object for transporting our settings
$setup = new Com\Wowza\Entities\Application\Helpers\Settings();
$setup->setHost(WOWZA_HOST);
$setup->setUsername(WOWZA_USERNAME);
$setup->setPassword(WOWZA_PASSWORD);

// Connect to the server or deal with statistics NOTICE THE CAPS IN COM AND WOWZA
$server = new Com\Wowza\Server($setup);
$sf = new Com\Wowza\Statistics($setup);
$response = $sf->getServerStatistics($server);
var_dump($response);

```

As you can see, it’s the same default config from their documentation. I can tell you, I have been following their read me / instruction carefully not to have inconsistent data, but still, same thing. And by the same thing I mean, that I have created my own library first for connecting to WOWZA via digest and it didn’t work, and after that I put the official PHP library and the result was the same. So my guessing is that it’s something with the actual auth with digest and not with the library.

We’re having a live event / live streaming on the 22nd of February, and me and my team are trying to figure this thing fast so that we can reach the timelimit for the event.

Thank you,

Kr,

Andrei

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [February 14, 2020, 2:36pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/12 "2020-02-14T14:36:14Z")

</div>

So sorry you are still having trouble with this. We will need you to open a support ticket so we can get a complete picture and help figure out what is going on - [https://www.wowza.com/support/open-ticket](https://www.wowza.com/support/open-ticket)

---

<div class="post-metadata">

### Author: ![Andrei\_Lucaci](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Andrei\_Lucaci](https://community.wowza.com/u/Andrei_Lucaci)
#### Post date: [February 14, 2020, 2:37pm UTC](https://community.wowza.com/t/wowza-streaming-engine-digest-auth-not-working/54642/13 "2020-02-14T14:37:31Z")

</div>

Ok, thank you.
