# Error on Opensearch authentication with Azure openid - "No 'Basic Authorization' header, send 401 and 'WWW-Authenticate Basic'"

**URL:** <https://forum.opensearch.org/t/error-on-opensearch-authentication-with-azure-openid-no-basic-authorization-header-send-401-and-www-authenticate-basic/7721>\
**Category:** OpenDistro\
**Created:** [November 23, 2021, 1:45pm UTC](https://forum.opensearch.org/t/error-on-opensearch-authentication-with-azure-openid-no-basic-authorization-header-send-401-and-www-authenticate-basic/7721 "2021-11-23T13:45:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![suman](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@suman](https://forum.opensearch.org/u/suman)\
**Post date:** [November 23, 2021, 1:45pm UTC](https://forum.opensearch.org/t/error-on-opensearch-authentication-with-azure-openid-no-basic-authorization-header-send-401-and-www-authenticate-basic/7721/1 "2021-11-23T13:45:22Z")

</div>

I have been trying to set Azure openid autentication to work with opensearch helm deploymnet. But upon accessing opensearch dashbord on web browser it ends up in redirect loop error " too many redirects "  
Hello,

I have shared the configuration that I’m testing with. In the logs all I can see is the error “No ‘Basic Authorization’ header, send 401 and ‘WWW-Authenticate Basic’”

Could anyone please review and comment what wrong with the config ? or how I can troubleshoot it further.

======= helm chart value========  
config:  
securityConfigSecret: “”  
data:  
config.yml: |-  
\_meta:  
type: “config”  
config\_version: 2  
config:  
dynamic:  
authc:  
basic\_internal\_auth\_domain:  
http\_enabled: true  
transport\_enabled: true  
order: 1  
http\_authenticator:  
type: basic  
challenge: false  
authentication\_backend:  
type: internal  
openid\_auth\_domain:  
http\_enabled: true  
transport\_enabled: true  
order: 0  
http\_authenticator:  
type: openid  
challenge: false  
config:  
subject\_key: preferred\_username  
roles\_key: roles  
openid\_connect\_idp:  
enable\_ssl: true  
verify\_hostnames: true  
openid\_connect\_url: “[https://login.microsoftonline.com/3abcd-1234-1234-1234-abcd12345/v2.0/.well-known/openid-configuration](https://login.microsoftonline.com/3abcd-1234-1234-1234-abcd12345/v2.0/.well-known/openid-configuration)”  
jwks\_uri: “[https://login.microsoftonline.com/3abcd-1234-1234-1234-abcd12345/discovery/v2.0/keys](https://login.microsoftonline.com/3abcd-1234-1234-1234-abcd12345/discovery/v2.0/keys)”  
skip\_users:  
- kibanaro  
- kibanaserver  
- admin  
authentication\_backend:  
type: noop

```
  roles.yml: |-
    _meta:
      type: "roles"
      config_version: 2
    # Restrict users 
    all_access:
    reserved: true 

  roles_mapping.yml: |-
    _meta:
      type: "rolesmapping"
      config_version: 2
    all_access:
      reserved: false
      backend_roles:
      - "admin"
      description: "Maps admin to all_access"

```

===========================

Error on Logs -

[2021-11-23T11:57:55,822][INFO][o.o.s.s.ConfigHelper] Will update ‘roles’ with /usr/share/opensearch/plugins/opensearch-security/securityconfig/roles.yml and populate it with empty doc if file missing and populateEmptyIfFileMissing=false  
[2021-11-23T11:57:55,823][ERROR][o.o.s.c.ConfigurationRepository] Cannot apply default config (this is maybe not an error!)  
java.lang.NullPointerException: Cannot invoke “org.opensearch.security.securityconf.impl.SecurityDynamicConfiguration.get\_meta()” because “sdc” is null  
at org.opensearch.security.securityconf.impl.SecurityDynamicConfiguration.validate(SecurityDynamicConfiguration.java:108) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.securityconf.impl.SecurityDynamicConfiguration.fromJson(SecurityDynamicConfiguration.java:89) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.securityconf.impl.SecurityDynamicConfiguration.fromJson(SecurityDynamicConfiguration.java:74) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.securityconf.impl.SecurityDynamicConfiguration.fromNode(SecurityDynamicConfiguration.java:123) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.support.ConfigHelper.fromYamlReader(ConfigHelper.java:142) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.support.ConfigHelper.fromYamlFile(ConfigHelper.java:151) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.support.ConfigHelper.uploadFile(ConfigHelper.java:73) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.support.ConfigHelper.uploadFile(ConfigHelper.java:65) ~[opensearch-security-1.1.0.0.jar:1.1.0.0]  
at org.opensearch.security.configuration.ConfigurationRepository$1.run(ConfigurationRepository.java:138) [opensearch-security-1.1.0.0.jar:1.1.0.0]  
at java.lang.Thread.run(Thread.java:832) [?:?]  
[2021-11-23T11:57:56,191][INFO][stdout] [FINE] No subscribers registered for event class org.opensearch.security.securityconf.DynamicConfigFactory$NodesDnModelImpl  
[2021-11-23T11:57:56,192][INFO][stdout] [FINE] No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent  
[2021-11-23T11:57:56,193][INFO][o.o.s.a.i.AuditLogImpl] Auditing on REST API is enabled.  
[2021-11-23T11:57:56,193][INFO][o.o.s.a.i.AuditLogImpl] [AUTHENTICATED, GRANTED\_PRIVILEGES] are excluded from REST API auditing.  
[2021-11-23T11:57:56,193][INFO][o.o.s.a.i.AuditLogImpl] Auditing on Transport API is enabled.  
[2021-11-23T11:57:56,194][INFO][o.o.s.a.i.AuditLogImpl] [AUTHENTICATED, GRANTED\_PRIVILEGES] are excluded from Transport API auditing.  
[2021-11-23T11:57:56,194][INFO][o.o.s.a.i.AuditLogImpl] Auditing of request body is enabled.  
[2021-11-23T11:57:56,209][WARN][o.o.s.a.r.AuditMessageRouter] No endpoint configured for categories [BAD\_HEADERS, FAILED\_LOGIN, MISSING\_PRIVILEGES, GRANTED\_PRIVILEGES, OPENDISTRO\_SECURITY\_INDEX\_ATTEMPT, SSL\_EXCEPTION, AUTHENTICATED, INDEX\_EVENT, COMPLIANCE\_DOC\_READ, COMPLIANCE\_DOC\_WRITE, COMPLIANCE\_EXTERNAL\_CONFIG, COMPLIANCE\_INTERNAL\_CONFIG\_READ, COMPLIANCE\_INTERNAL\_CONFIG\_WRITE], using default endpoint  
[2021-11-23T11:57:56,218][INFO][o.o.s.a.i.AuditLogImpl] .opendistro\_security is used as internal security index.  
[2021-11-23T11:57:56,219][INFO][o.o.s.a.i.AuditLogImpl] Internal index used for posting audit logs is null  
[2021-11-23T11:57:56,220][INFO][o.o.s.c.ConfigurationRepository] Hot-reloading of audit configuration is enabled  
[2021-11-23T11:57:56,220][INFO][o.o.s.c.ConfigurationRepository] Node ‘opensearch-cluster-master-2’ initialized  
[2021-11-23T11:59:42,387][WARN][o.o.s.h.HTTPBasicAuthenticator] No ‘Basic Authorization’ header, send 401 and ‘WWW-Authenticate Basic’  
[2021-11-23T11:59:43,782][WARN][o.o.s.h.HTTPBasicAuthenticator] No ‘Basic Authorization’ header, send 401 and ‘WWW-Authenticate Basic’  
[2021-11-23T11:59:45,093][WARN][o.o.s.h.HTTPBasicAuthenticator] No ‘Basic Authorization’ header, send 401 and ‘WWW-Authenticate Basic’

===============

---

<div class="post-metadata">

**Author:** ![rzearreta](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@rzearreta](https://forum.opensearch.org/u/rzearreta)\
**Post date:** [October 20, 2022, 3:24pm UTC](https://forum.opensearch.org/t/error-on-opensearch-authentication-with-azure-openid-no-basic-authorization-header-send-401-and-www-authenticate-basic/7721/2 "2022-10-20T15:24:09Z")

</div>

Hi, the very same problem here with version 2.3.0.

Any ideas?

Regards.
