# Multiple credentials for basic-auth with ingress-controller

**URL:** <https://discuss.konghq.com/t/multiple-credentials-for-basic-auth-with-ingress-controller/5765>\
**Category:** Questions\
**Created:** [March 12, 2020, 12:53am UTC](https://discuss.konghq.com/t/multiple-credentials-for-basic-auth-with-ingress-controller/5765 "2020-03-12T00:53:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![HYUN\_SUK\_JUNG](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hyun_suk_jung/32/1122_2.png) [@HYUN\_SUK\_JUNG](https://discuss.konghq.com/u/HYUN_SUK_JUNG)\
**Post date:** [March 12, 2020, 12:53am UTC](https://discuss.konghq.com/t/multiple-credentials-for-basic-auth-with-ingress-controller/5765/1 "2020-03-12T00:53:29Z")

</div>

I want change KongCredential to k8s Secret  
I use basic-auth multi-user

The first basic-user working correctly  
But basic-user2 is not working

curl result is “{“message”:“Invalid authentication credentials”}”  
kong log :

1. basic-user2 : 10.242.0.26 - - [12/Mar/2020:00:49:11 +0000] “GET /service/health HTTP/1.1” 401 48 “-” “curl/7.29.0”
2. basic-user : 10.242.0.26 - - [12/Mar/2020:00:49:59 +0000] “GET /service/health HTTP/1.1” 200 2 “-” “curl/7.29.0”

**How can I add multiple user for basic auth?**

env: kong : 2.0.2  
ingress-controller : 0.7.1

```
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
  annotations:
    kubernetes.io/ingress.class: a-kong
  name: basic-consumer
credentials:
- basic-user
  basic-user2
username: basic-consumer
custom_id: basic-consumer

---

apiVersion: v1
kind: Secret
metadata:
  name: basic-user
stringData:
  kongCredType: basic-auth
  username: abcuser1
  password: user1

---
apiVersion: v1
kind: Secret
metadata:
  name: basic-user2
stringData:
  kongCredType: basic-auth
  username: abcuser2
  password: user2
```

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [March 12, 2020, 4:44pm UTC](https://discuss.konghq.com/t/multiple-credentials-for-basic-auth-with-ingress-controller/5765/2 "2020-03-12T16:44:30Z")

</div>

Can you check if the credentials are correctly created in Kong via the Admin API?

---

<div class="post-metadata">

**Author:** ![HYUN\_SUK\_JUNG](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hyun_suk_jung/32/1122_2.png) [@HYUN\_SUK\_JUNG](https://discuss.konghq.com/u/HYUN_SUK_JUNG)\
**Post date:** [March 13, 2020, 12:59am UTC](https://discuss.konghq.com/t/multiple-credentials-for-basic-auth-with-ingress-controller/5765/3 "2020-03-13T00:59:21Z")

</div>

I added admin function and check credentials  
**1 credential works fine but over 2 credentials are not working**

Am I wrong configure of credentials?

ex) add 1 credential

```
credentials:
- basic-user

{"next":null,"data":[{"created_at":1584060826,"consumer":{"id":"e93d9b57-3371-5a08-8e27-4b3b63a186f4"},"id":"9f424369-fd52-52d8-b940-79058b99da92","tags":null,"username":"user1","password":"2d469bac5ff20ba812718784b4721b7d3c6ec9ca"}]}

```

ex) add 2 credential

```
credentials:
- basic-user
  basic-user2

{"next":null,"data":[]}
```

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [March 13, 2020, 4:38pm UTC](https://discuss.konghq.com/t/multiple-credentials-for-basic-auth-with-ingress-controller/5765/4 "2020-03-13T16:38:07Z")

</div>

> [@HYUN\_SUK\_JUNG](#):
>
> credentials: - basic-user basic-user2

You’ve a typo. It should be:

```yaml
credentials:
- basic-user
- basic-user2

```

---

<div class="post-metadata">

**Author:** ![HYUN\_SUK\_JUNG](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hyun_suk_jung/32/1122_2.png) [@HYUN\_SUK\_JUNG](https://discuss.konghq.com/u/HYUN_SUK_JUNG)\
**Post date:** [March 16, 2020, 12:22am UTC](https://discuss.konghq.com/t/multiple-credentials-for-basic-auth-with-ingress-controller/5765/5 "2020-03-16T00:22:12Z")

</div>

Hahaha  
Thank you for your support ^^
