Basic Auth: Consumers with same username


#1

Hi

I have a usecase where there are two consumers with same username but I cant configure it using basic auth plugin as username has to be unique
Is there any way to handle such scenario?

curl -d “username=user123&custom_id=SOME_CUSTOM_ID” http://localhost:8001/consumers/

curl -X POST http://localhost:8001/consumers/user123/basic-auth --data “username=Aladdin” --data “password=OpenSesame”

curl -d “username=user1234&custom_id=SOME_CUSTOM_ID1” http://localhost:8001/consumers/

curl -X POST http://localhost:8001/consumers/user1234/basic-auth --data “username=Aladdin” --data “password=OpenSesame”

{“message”:“UNIQUE violation detected on ‘{username=“Aladdin”}’”,“name”:“unique constraint violation”,“fields”:{“username”:“Aladdin”},“code”:5}

Why there is violation when I am creating same username in other different consumer?
Does Kong does not not support same username with different consumers ?


#2

Hi,

Please do not cross post between this forum and GitHub issues (https://github.com/Kong/kong/issues/4282). This is duplicating work for us and someone is already helping you on your other post.

Thanks.


#3

Hi
Sorry for the trouble, I posted it out of confusion related to the category of the issue