Just working through the QuickStart and then some basic use cases, and I’m struggling to enable authentication on a Consumer. The docs imply that this is possible, but I can’t get it to work.
I’m calling
curl -X POST \
http://127.0.0.1:8001/consumers/{ServiceID}/plugins \
-F name=key-auth
and getting this response:
{
"message": "schema violation (consumer: value must be null)",
"name": "schema violation",
"fields": {
"consumer": "value must be null"
},
"code": 2
}
Should I be able to do this, and, if so, what am I missing?
aah… ok! key-auth plugin is enabled at service/route level and can’t be enabled at consumer-level as far as i know. Once you enable key-auth plugin for service/route, consumers need to pass the configured key in their requests to authenticate themselves.
On a separate note, not sure if you were looking for generating credentials for a consumer - one of the credential methods allowed is API Keys: to create an API key for a consumer, use "curl -X POST http://<kong_ip>:8001/consumers/{consumer}/key-auth -d ‘’ " - if you don’t pass , kong should create one (recommended). This key then can then be passed as querysting/header in your requests to authenticate this particular consumer.