Authentication with Consumers

    If you prefer to use the Admin API, check out the .

    From the Workspaces tab in Kong Manager:

    1. Open the default workspace.
    2. From the sub-menu, select the Plugins tab, then click Install Plugin.
    3. Find the Key Authentication plugin and click Enable.
    4. On the Install plugin: key-auth page, the plugin fields are automatically scoped to the route because the plugin is selected from the mocking route’s page.

    5. Click Create.

    Now, if you try to access the route without providing an API key, the request will fail, and you’ll see the message

    Before Kong proxies requests for this route, it needs an API key. For this example, since you installed the Key Authentication plugin, you need to create a consumer with an associated key first.

    1. Open the default workspace.
    2. Enter a Username and Custom ID. For this example, you can use for each field.
    3. Click Create.
    4. On the Consumers page, open your new consumer.
    5. Open Credentials from the sub-menu.
    6. Click New Key Auth Credential.

    The new Key Authentication ID displays on the Consumers page under the Credentials tab.

    To validate the Key Authentication plugin, access your route through your browser by appending to the url:

    Next, you’ll learn about load balancing upstream services using targets.