Basic Authorization not Found on OpenDistro 1.4.0 with Keycloak 9.0.0

Hello everybody,

I installed on my PC (windows 10 x86_64) the applications in question:

OpenDistro 1.4.0
OpenDistro-Kibana 1.4.0
Keycloak 9.0.0

to test how OpenDistro works with OpenID. I mainly followed this guide: OPENID and modified the files indicated.


  anonymous_auth_enabled: false
    enabled: false
    description: "Authenticate via HTTP Basic against internal users database"
    http_enabled: true
    transport_enabled: true
    order: 0
      type: basic
      challenge: false
      type: internal
    http_enabled: true
    transport_enabled: true
    order: 1
      type: openid
      challenge: false
        subject_key: preferred_username
        roles_key: roles
        openid_connect_url: http://localhost:8080/auth/realms/master/.well-known/openid-configuration
     type: noop


opendistro_security.auth.type: "openid"
opendistro_security.openid.connect_url: same of the previous
opendistro_security.openid.client_id: "kibana-sso"
opendistro_security.openid.client_secret: "285d9831-dd11-4494-bf29-68fa5e883cb4"
elasticsearch.hosts: local port 9200
elasticsearch.username: "kibanaserver"
elasticsearch.password: "kibanaserver"
elasticsearch.ssl.verificationMode: none
elasticsearch.requestHeadersWhitelist: ["Authorization", "securitytenant"]
opendistro_security.readonly_mode.roles: ["kibana_read_only"]

I created the kibanaserver user on keycloak, created the kibana-sso client_id and associated the client_secret. Then I created the kibana_read_only and all_access roles and associated them to the user.

Also reading on this forum I mapped the user roles in the roles key so that they are found by elasticsearch.
This is an example token generated by keycloak:


  "jti": "b376f332-b73c-43bc-aa3b-bc2fe34232b6",
  "exp": 1582727866,
  "nbf": 0,
  "iat": 1582727806,
  "iss": "http://localhost:8080/auth/realms/master",
  "aud": "kibana-sso",
  "sub": "479046b6-b66c-45f1-b12f-a6a54c3f3db1",
  "typ": "ID",
  "azp": "kibana-sso",
  "auth_time": 1582727303,
  "session_state": "fdcdeb2a-79ad-468a-a418-c857ed48650d",
  "acr": "0",
  "address": {},
  "email_verified": false,
  "roles": [
  "preferred_username": "kibanaserver"

All programs run on the same machine in localhost and only elasticsearch has https. I haven’t changed the certificates because I think that currently the demo ones are enough.

The connection to kibana is done correctly and also the switch to keycloak. But once I enter the keycloak username and password I get a customerror?type=authError#?_g=() error.
and in the elastic search log you can read
No ‘Basic Authorization’ header, send 401 and ‘WWW-Authenticate Basic’.

Does anyone have any idea why this is happening?

1 Like


The problem is hidden in the boot of opendistro. At startup, an instance is created on elasticsearch with the configuration present at that time in config.yml. So if a user downloads openDistro and starts it, it automatically loads only the Basic Authenticator and any subsequent changes made to config.yml are ignored.

So the files shown in the previous post are correct, but must be inserted before the first boot.

Facing this issue , can anybody help

1 Like

@claudiobadii Can you please send the brief about how it worked and share the configuration for the same.

Hi All, if you are having issues with keycloak and odfe, can you share your config files and any errors that you are seeing on screen and in logs.