Error 401 Unauthorized

Hey there,
I have a problem with the icinga Director API. When I want to connect to the director via API as described on Rest Api - Icinga Director I receive the message 401 Unauthorized.

I created a API user with permissions = [ “*” ]

OS: CentOS 8.4.2105
apache: Apache/2.4.37 (centos)
PHP: PHP 7.2.24 (fpm-fcgi)
icingaweb2: 2.8.2
icinga director: 1.8.0
icinga2: 2.12.4

The Output with -vvv is

Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying ::1...
* Connected to localhost (::1) port 80 (#0)
* Server auth using Basic with user 'apiuser'
> GET /icingaweb2/director/host?name=icinga01 HTTP/1.1
> Host: localhost
> Authorization: Basic ****************************=
> User-Agent: curl/7.61.1
> Accept: application/json
< HTTP/1.1 401 Unauthorized
< Date: Tue, 03 Aug 2021 06:55:01 GMT
< Server: Apache/2.4.37 (centos) OpenSSL/1.1.1g
< X-Powered-By: PHP/7.2.24
* Authentication problem. Ignoring this.
< Www-Authenticate: Basic realm="Icinga Web 2"
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
* Connection #0 to host localhost left intact

I have seen the Issue on github API - 401 Unauthorized · Issue #1362 · Icinga/icingaweb2-module-director · GitHub
and the

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

is set in the “apache >= 2.4” section of /etc/httpd/conf.d/icingaweb2.conf.

I have no idea, where to search to solve the issue.

Thanks a lot


where did you create the API User for the director?
Did you create an icingaweb2 user oder did you create an icinga2 api user?

Now I feel a bit silly :roll_eyes: I did not see the difference. Thank you so much for this information.

No, it’s not the same. Director is a module for icingaweb2. So you need to create an icingaweb2 user. And as permission you need to activate this:

So we speak from two diffrent APIs. You’ll wee this also at the access url :wink: