# Consumer Key Auth Credential creation in Kong Connect

**URL:** <https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556>\
**Category:** Questions\
**Created:** [May 30, 2023, 4:03pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556 "2023-05-30T16:03:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmcacereso](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jmcacereso](https://discuss.konghq.com/u/jmcacereso)\
**Post date:** [May 30, 2023, 4:03pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/1 "2023-05-30T16:03:31Z")

</div>

Hello, using the kong connect management api, how can i create a Key Auth Credential for a consumer?

---

<div class="post-metadata">

**Author:** ![jmcacereso](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jmcacereso](https://discuss.konghq.com/u/jmcacereso)\
**Post date:** [June 1, 2023, 4:39pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/2 "2023-06-01T16:39:39Z")

</div>

Somebody can help me on this?

---

<div class="post-metadata">

**Author:** ![Ross\_Kukulinski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ross_kukulinski/32/3255_2.png) [@Ross\_Kukulinski](https://discuss.konghq.com/u/Ross_Kukulinski)\
**Post date:** [June 1, 2023, 8:16pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/3 "2023-06-01T20:16:31Z")

</div>

Hello -

This can be found within Runtime Manager. Runtime Manager → Runtime Group → Consumers. After creating a consumer, go to Credentials and select key auth. Then you can generate a key auth credential (define it yourself, or have Konnect generate it)

Then you’ll want to enable the Key Auth plugin (and _probably_ an ACL plugin if approproriate) on your Runtime Group / Service / or Route.

 ![keyauth1](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/2/2c44317a5f400655846f3580c1c35bf86d0b2143.jpeg)

---

<div class="post-metadata">

**Author:** ![jmcacereso](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jmcacereso](https://discuss.konghq.com/u/jmcacereso)\
**Post date:** [June 1, 2023, 8:54pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/4 "2023-06-01T20:54:24Z")

</div>

Thanks I appreciate your answer but I’m looking instead to do that in the screen, achieve that through API in Konnect.

Thanks

---

<div class="post-metadata">

**Author:** ![Ross\_Kukulinski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ross_kukulinski/32/3255_2.png) [@Ross\_Kukulinski](https://discuss.konghq.com/u/Ross_Kukulinski)\
**Post date:** [June 1, 2023, 9:24pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/5 "2023-06-01T21:24:36Z")

</div>

Something like this if you’re using [deck](https://docs.konghq.com/deck/1.19.x/):

```auto
_format_version: "3.0"
_konnect:
  runtime_group_name: production-blue
consumers:
- acls:
  - group: 3c0cd06f-af71-4b4a-99ef-74044a9dcfdf
  custom_id: my-ios-application
  keyauth_credentials:
  - key: ZXELXKXyejKIfYy1uFZQtcZ6CmbNl8Vk
  - key: 2k877h394L1PMZ4iofym5K6HfA6THLsl
  username: rossk

```

Via direct API, you’d be using the Runtime Groups Config API ([Developer Portal](https://developer.konghq.com/spec/3c38bff8-3b7b-4323-8e2e-690d35ef97e0/16adcd15-493a-49b2-ad53-8c73891e29bf#/Gateway%20Core%20Entities/post-core-entities)) with the Consumer Object type ([Admin API - v3.3.x | Kong Docs](https://docs.konghq.com/gateway/latest/admin-api/#consumer-object))

---

<div class="post-metadata">

**Author:** ![jmcacereso](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jmcacereso](https://discuss.konghq.com/u/jmcacereso)\
**Post date:** [June 1, 2023, 9:38pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/6 "2023-06-01T21:38:24Z")

</div>

Great, which one will be the BaseUrl for Konnect? Because in the documentation point to the gateway and the port 8001and the dataplate do not have that port open and from outside that port and url is not accesible.

Thanks Ross for your time

---

<div class="post-metadata">

**Author:** ![Ross\_Kukulinski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ross_kukulinski/32/3255_2.png) [@Ross\_Kukulinski](https://discuss.konghq.com/u/Ross_Kukulinski)\
**Post date:** [June 1, 2023, 9:50pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/7 "2023-06-01T21:50:11Z")

</div>

[Konnect Runtime Configuration API | Kong Docs](https://docs.konghq.com/konnect/api/runtime-groups-config/) should have more info for you. The base url will be:

 ![Screenshot 2023-06-01 at 2.49.48 PM](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/b/b1a0f649da8999675f1be3015858b2c2da16c9d8.png)

Where runtime\_group\_id is the unique ID of the runtime group you want to use.

---

<div class="post-metadata">

**Author:** ![shunsukew](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/shunsukew/32/4232_2.png) [@shunsukew](https://discuss.konghq.com/u/shunsukew)\
**Post date:** [November 14, 2023, 12:08pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/8 "2023-11-14T12:08:07Z")

</div>

Hello,  
I’m also using Kong Konnect API to issue keys for consumers.

It seems key auth credential endpoint is not mentioned in neither [linked doc above](https://docs.konghq.com/konnect/api/runtime-groups-configuration/v2/?&_ga=2.211652499.726792594.1699842244-437264331.1697446194#/Gateway%20Core%20Entities/post-core-entities) nor [the latest doc](https://docs.konghq.com/konnect/api/control-plane-configuration/v2/).

But, found out from deck source code, API endpoint is `/v2/control-planes/{control-plane-id}/core-entities/consumers/{consumer-id-or-name}/key-auth/{key-id-or-name}`

However, when passing key (instead of key id), API returns 404 not found error.  
When using Admin API, using key is allowed. Is it expected behaviour of Kong Konnect API?  
I’d expected Kong Konnect (core entities) API is full compatible with Admin API but the reality is not.

First one - getting key by id succeeds  
Second one - getting key by name fails

 ![Screen Shot 2023-11-14 at 21.10.42](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/a/a4ece0944729194cb9a35b147482bf375f7dee80.png)

---

<div class="post-metadata">

**Author:** ![Ross\_Kukulinski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ross_kukulinski/32/3255_2.png) [@Ross\_Kukulinski](https://discuss.konghq.com/u/Ross_Kukulinski)\
**Post date:** [November 14, 2023, 10:39pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/9 "2023-11-14T22:39:24Z")

</div>

Konnect Gateway Control Plane API is _nearly_ identical with the on-prem Admin API, but there are still a few edge cases. This is one of them and is on the engineering roadmap to support. In the meantime, you can use the consumer-id / key-id for direct access of those objects.

---

<div class="post-metadata">

**Author:** ![shunsukew](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/shunsukew/32/4232_2.png) [@shunsukew](https://discuss.konghq.com/u/shunsukew)\
**Post date:** [November 15, 2023, 1:22pm UTC](https://discuss.konghq.com/t/consumer-key-auth-credential-creation-in-kong-connect/11556/10 "2023-11-15T13:22:05Z")

</div>

I see,  
Thank you so much for the clarifying.
