Blog
  • AI Gateway
  • AI Security
  • AIOps
  • API Security
  • API Gateway
    • API Management
    • API Development
    • API Design
    • Automation
    • Service Mesh
    • Insomnia
    • View All Blogs
  1. Home
  2. Blog
  3. Engineering
  4. Implementing Client Credentials With Kong and Okta
Engineering
May 13, 2021
4 min read

Implementing Client Credentials With Kong and Okta

Claudio Acquaviva
Principal Architect, Kong
Topics
API AuthenticationOAuthAPI Authorization
Share on Social

More on this topic

eBooks

Securing Web and Mobile Applications and APIs with Centralized Authorization and Authentication Policies

Videos

Service Catalog with Traceable AI

See Kong in action

Accelerate deployments, reduce vulnerabilities, and gain real-time visibility. 

Get a Demo

Using Kong's OpenID Connect (OIDC) plugin, Kong and Okta work together to solve three significant application development challenges:

  1. Connectivity
  2. Authentication
  3. Authorization

The OIDC plugin enables Kong, as the API gateway, to communicate with Okta via the OAuth/OIDC flows. That way, your app teams don't have to configure and diagnose authentication and authorization for each service individually. With these challenges solved, app teams have more time to build and innovate.

This series will show you how to implement service authentication and authorization for Kong Konnect and Okta using the OIDC plugin. In this tutorial, we'll cover client credentials flow for application authentication. Parts 2-4 will cover:

  • Authorization code for user authentication
  • Integral introspection for token validation
  • Access control based on Okta’s groups and planes

Konnect and Okta Integration Topology

In the below diagram, the API gateway splits into two sublayers. The first is the control plane used by admins to create new APIs and policies. The second sublayer is accountable for request processing and API conception and contains the control plane responsible for publishing those APIs and policies to the data plane.

My topology has two data planes: the first running locally and the second running as a Docker container in an AWS EC2 instance. The integration is possible because Kong provides a specific plugin to implement the OAuth/OIDC flows from the API gateway. The OIDC plugin will submit the consumer to Okta’s authentication processes before consuming the API.

Kong and Okta Integration Topology

Set Up Konnect Service and Route

Konnect is a cloud native service connectivity platform hosted as a service. It can take care of all connectivity use cases across any environment, including virtual machines (VMs) and Kubernetes.

Start by going to the ServiceHub in the Kong Konnect Enterprise Admin GUI. In my example, I've already set up a service. If you haven't already, follow the Kong Documentation to set up a service before continuing to the next steps.

Kong Konnect Service Hub
My service has only one version. We could define multiple versions with different definitions and policies if necessary.Kong Konnect Service Versions
We could click on the service version to see the routes that are already exposing a service.

Kong Konnect Service Version Route


In my example, I'm going to consume and protect the /oidcroute. With no policy enabled, anyone can start consuming the route without any restriction. That's why it's critical to define and apply policies, like OIDC with Okta, to control this consumption.

Set Up Okta

My demo environment has two previously created Okta applications. In this example, I will use the Kong client credentials app.

Kong and Okta Client Credentials App

Create Konnect Data Plane

We'll run our Konnect data plane on an AWS EC2 instance in a Docker container. The control plane has a specific component called Runtime Manager. The Runtime Manager handles monitoring the currently installed data planes.

Kong Konnect Runtime Manager

Click Configure Runtime to see the script we'll run to instantiate a Docker-based data plane.

Kong Konnect Configure New Runtime

Run the script in the EC2 terminal to get our first data plane up and running. In my example, I have already updated the script to use my Kong Konnect credentials. It will pull from the Kong Docker image.

Ready to launch, enjoy the flight! I've now deployed the data plane, and all the APIs are already available to consume.

Kong Konnect Set Up Data Plane

Consume the Route Without a Policy

If we try to consume the route now by sending a request to http: 8000/oidcroute/get, we'll be able to consume the route as expected.

Kong Konnect Consume Route

However, since we haven't set any policy to control the route consumption, anyone could send as many requests as they want. To solve this, we'll need to set up the OIDC policy to control the route consumption.

Add OpenID Connect Plugin

To add the OIDC plugin, go to the ServiceHub > Service > Versions > Service Version > Add Plugin.

The plugin is expecting four parameters to integrate with Okta.

    1. Config.ClientId–issued from Okta
    2. Config.Client Secret
    3. Config.Issuer–Okta’s endpoint
    4. Config.Scopes

After configuring those four settings, click Create to save our settings.

Test the OpenID Connect Plugin

Let’s go back to our terminal and try to consume the route using http: 8000/oidcroute/get. The API gateway won’t allow us because we’re not providing the credentials.

If we try to send the same request, including our credentials (the client ID and client secret), we can consume the route.

Kong and Okta Test OIDC Plugin

We can also decode the token issued by Okta on jwt.io and check all the fields inside it.

Kong and Okta decode JWT token

Upstream Header Injection

The OIDC plugin provides upstream header injection. That means we can extend requests with extra headers. Doing so sends the upstream or microservice more information about the authentication process. As an exercise, we can inject a header based on the ISS field, which is Okta’s issuer endpoint.

To set extra OIDC plugin parameters, use the Kong Konnect control plane to:

  1. Edit the OIDC plugin and enter iss into the field: Config.Upstream Headers Claims.
  2. Enter Issuer_Header in the field: Config.Upstream Headers Names.
  3. Click Update.

Let’s consume the route one more time and inject a brand new header into our request.

Kong and Okta upstream header injection

Protect Your Applications with Kong Konnect and Okta

Start a free trial or contact us if you have any questions as you're getting set up.

Once you've set up Konnect and Okta, you may find these other tutorials helpful:

  • 3 Ways Kong Helps With API Gateway Governance
  • Getting Started with Kong Mesh and Open Policy Agent
  • Protect Your APIs With Kong Konnect and Fastly (Signal Sciences)
Topics
API AuthenticationOAuthAPI Authorization
Share on Social
Claudio Acquaviva
Principal Architect, Kong

Recommended posts

Unlocking API Analytics for Product Managers

Kong Logo
EngineeringSeptember 9, 2025

Meet Emily. She’s an API product manager at ACME, Inc., an ecommerce company that runs on dozens of APIs. One morning, her team lead asks a simple question: “Who’s our top API consumer, and which of your APIs are causing the most issues right now?”

Christian Heidenreich

How to Build a Multi-LLM AI Agent with Kong AI Gateway and LangGraph

Kong Logo
EngineeringJuly 31, 2025

In the last two parts of this series, we discussed How to Strengthen a ReAct AI Agent with Kong AI Gateway and How to Build a Single-LLM AI Agent with Kong AI Gateway and LangGraph . In this third and final part, we're going to evolve the AI Agen

Claudio Acquaviva

How to Build a Single LLM AI Agent with Kong AI Gateway and LangGraph

Kong Logo
EngineeringJuly 24, 2025

In my previous post, we discussed how we can implement a basic AI Agent with Kong AI Gateway. In part two of this series, we're going to review LangGraph fundamentals, rewrite the AI Agent and explore how Kong AI Gateway can be used to protect an LLM

Claudio Acquaviva

How to Strengthen a ReAct AI Agent with Kong AI Gateway

Kong Logo
EngineeringJuly 15, 2025

This is part one of a series exploring how Kong AI Gateway can be used in an AI Agent development with LangGraph. The series comprises three parts: Basic ReAct AI Agent with Kong AI Gateway Single LLM ReAct AI Agent with Kong AI Gateway and LangGr

Claudio Acquaviva

Build Your Own Internal RAG Agent with Kong AI Gateway

Kong Logo
EngineeringJuly 9, 2025

What Is RAG, and Why Should You Use It? RAG (Retrieval-Augmented Generation) is not a new concept in AI, and unsurprisingly, when talking to companies, everyone seems to have their own interpretation of how to implement it. So, let’s start with a r

Antoine Jacquemin

AI Gateway Benchmark: Kong AI Gateway, Portkey, and LiteLLM

Kong Logo
EngineeringJuly 7, 2025

In February 2024, Kong became the first API platform to launch a dedicated AI gateway, designed to bring production-grade performance, observability, and policy enforcement to GenAI workloads. At its core, Kong’s AI Gateway provides a universal API

Claudio Acquaviva

Scalable Architectures with Vue Micro Frontends: A Developer-Centric Approach

Kong Logo
EngineeringJanuary 9, 2024

In this article, which is based on my talk at VueConf Toronto 2023, we'll explore how to harness the power of Vue.js and micro frontends to create scalable, modular architectures that prioritize the developer experience. We'll unveil practical strate

Adam DeHaven

Ready to see Kong in action?

Get a personalized walkthrough of Kong's platform tailored to your architecture, use cases, and scale requirements.

Get a Demo
Powering the API world

Increase developer productivity, security, and performance at scale with the unified platform for API management, AI gateways, service mesh, and ingress controller.

Sign up for Kong newsletter

Platform
Kong KonnectKong GatewayKong AI GatewayKong InsomniaDeveloper PortalGateway ManagerCloud GatewayGet a Demo
Explore More
Open Banking API SolutionsAPI Governance SolutionsIstio API Gateway IntegrationKubernetes API ManagementAPI Gateway: Build vs BuyKong vs PostmanKong vs MuleSoftKong vs Apigee
Documentation
Kong Konnect DocsKong Gateway DocsKong Mesh DocsKong AI GatewayKong Insomnia DocsKong Plugin Hub
Open Source
Kong GatewayKumaInsomniaKong Community
Company
About KongCustomersCareersPressEventsContactPricing
  • Terms•
  • Privacy•
  • Trust and Compliance•
  • © Kong Inc. 2025