How can a consumer credential be deleted with the Admin API?
Deleting a consumer credential with the Admin API
Uses:
Kong Gateway
TL;DR
How can a consumer credential be deleted with the Admin API?
Send a DELETE request to the credential’s Admin API endpoint, for example DELETE /default/consumers/joe/basic-auth/testcred. The path segment (basic-auth, key-auth, acls, hmac-auth, jwt, oauth2) and identifier field vary by credential type.
Steps
You can delete a specific credential by sending a DELETE request to
http(s)://<kong-host>:<admin-port>/consumers/<workspace>/<consumer_id_or_name>/<type of credentials>/<credentials_id_or_name>For example, assuming the below parameters this can be used to delete a basic auth credential:
kong-host: localhost
admin-port: 8001
workspace: default
consumer name: joe
credential type: basic-auth
credential username: testcredRequest:
curl -X DELETE -H "kong-admin-token:kong" http://localhost:8001/default/consumers/joe/basic-auth/testcredThe credential types and named fields are as follows:
|
Credential Type |
Value |
Field Reference |
Example |
|---|---|---|---|
| Basic Authentication | basic-auth | Username |
:8001/default/consumers/joe/basic-auth/ |
| ACL | acls | Group |
:8001/default/consumers/joe/acls/ |
| Key Authentication | key-auth | Key |
:8001/default/consumers/joe/key-auth/ |
| HMAC Authentication | hmac-auth | Username |
:8001/default/consumers/joe/hmac-auth/ |
| JWT | jwt | Key |
:8001/default/consumers/joe/jwt/ |
| OAuth 2.0 | oauth2 | Client ID |
:8001/default/consumers/joe/oauth2/ |