I see in the documentation of the oauth2-authentication plugin that I can use the http://kong:8001/consumers/{consumer_id}/oauth2 endpoint to create an application.
How can I delete an application, i.e. revoke a client_id/client_secret pair?
I see in the documentation of the oauth2-authentication plugin that I can use the http://kong:8001/consumers/{consumer_id}/oauth2 endpoint to create an application.
How can I delete an application, i.e. revoke a client_id/client_secret pair?
Hi Alsciende!
To delete an OAuth2 application, you would
DELETE <kong>:8001/consumers/<$consumerID>/oauth2/<$applicationID>
Thank you @jpk
I won’t know the $applicationID when trying to delete, only the client_id. Can I get the list of $applicationID with a GET <kong>:8001/consumers/<$consumerID>/oauth2/
request, so that I can find the one with my client_id and delete it?
To get the $applicationID you’ll first need to GET `:8001/consumers/<$consumerID>/oauth2
That will display the ID and a few other pieces of information. With that ID, you can then delete it. I’ll post a quick example I just did. I used httpie but curl will work just as well:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Wed, 10 Jan 2018 17:56:25 GMT
Server: kong/0.29-enterprise-edition
Transfer-Encoding: chunked
{
"data": [
{
"created_at": 1515524864000,
"id": "7c2d91d8-87c0-4de1-9a3e-96cf8f0ee6be",
"username": "b boob bop"
}
],
"total": 1
}
jpk@JPK-Loves-Kong ~> http GET :8001/consumers/7c2d91d8-87c0-4de1-9a3e-96cf8f0ee6be
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Wed, 10 Jan 2018 17:56:34 GMT
Server: kong/0.29-enterprise-edition
Transfer-Encoding: chunked
{
"created_at": 1515524864000,
"id": "7c2d91d8-87c0-4de1-9a3e-96cf8f0ee6be",
"username": "b boob bop"
}
jpk@JPK-Loves-Kong ~> http GET :8001/consumers/7c2d91d8-87c0-4de1-9a3e-96cf8f0ee6be/oauth2
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Wed, 10 Jan 2018 17:56:48 GMT
Server: kong/0.29-enterprise-edition
Transfer-Encoding: chunked
{
"data": [
{
"client_id": "6IDTRaPBPwLXJCJa7FV0bwOapNQQRqgx",
"client_secret": "Ar42MCACw27G0DlChd22C9qSw7cuYd9N",
"consumer_id": "7c2d91d8-87c0-4de1-9a3e-96cf8f0ee6be",
"created_at": 1515606687000,
"id": "f595630c-d8e0-4b54-b48a-8bfb4f25f4ee",
"name": "oaApp",
"redirect_uri": [
"http://httpbin.org/ip"
]
}
],
"total": 1
}
jpk@JPK-Loves-Kong ~> http DELETE :8001/consumers/7c2d91d8-87c0-4de1-9a3e-96cf8f0ee6be/oauth2/f595630c-d8e0-4b54-b48a-8bfb4f25f4ee
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: *
Connection: keep-alive
Date: Wed, 10 Jan 2018 18:14:12 GMT
Server: kong/0.29-enterprise-edition
jpk@JPK-Loves-Kong ~> http GET :8001/consumers/7c2d91d8-87c0-4de1-9a3e-96cf8f0ee6be/oauth2
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Wed, 10 Jan 2018 18:14:20 GMT
Server: kong/0.29-enterprise-edition
Transfer-Encoding: chunked
{
"data": [],
"total": 0
}