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. Applying Authorization Code Flow With Kong and Okta
Engineering
May 27, 2021
3 min read

Applying Authorization Code Flow With Kong and Okta

Claudio Acquaviva
Principal Architect, Kong

In our second Kong and Okta tutorial, we'll go through the authorization code flow applied to user authentication processes. This series will show you how to implement service authentication and authorization for Kong Konnect and Okta using the OpenID Connect (OIDC) plugin. Parts 1, 3 and 4 cover:

  • Implementing client credentials flow for application authentication
  • Integral introspection for token validation (coming soon)
  • Access control based on Okta's groups and planes (coming soon)

Konnect and Okta Integration Topology

The Konnect control plane creates new APIs and policies and publishes them to the data plane running as a Docker container in an AWS EC2 instance.

Kong Konnect and Okta Integration Topology

Authorization Code Flow

The authorization code flow goes through the following steps:

  1. A user tries to consume the API.
  2. If the user doesn’t have a token injected, Kong redirects the user to Okta, the identity provider.
  3. The user authenticates on Okta and is sent back to Kong with an authorization code token.
  4. Kong validates the parameters and exchanges the authorization code token by calling Okta’s token endpoint.

OpenID Connect Sign In

Add Your Services and Routes to Konnect

In Konnect's ServiceHub, I have a service created already. Follow along in our Getting Started with Konnect tutorial to learn how to create a service and routes.

My service has two routes defined already. I used the first service in the previous Kong and Okta tutorial to show the client credentials flow. In this tutorial, I'll use the second service to apply the OIDC plugin utilizing the authorization code flow.

Kong Konnect OIDC Authorization Code Flow Route

Set Up the Okta Application

In Okta, I prepared an application to implement the authorization flow already. In the Kong authorization code application, we’re going to use the configured OIDC plugin in addition to the client ID and client secret.

Kong and Okta OIDC Application Authorization Code Flow


The app has the authorization code option turned on and the signing redirect URI set with the route available in my data plane. That means the authorization code is accepted for this URI only.

Kong and Okta Authorization Code Flow Application Settings

Consume the Route Without a Policy

Any user is free to consume the route right now since there's no policy to control it.

Kong Konnect route with no OIDC policy

Apply the OpenID Connect Plugin

Just like we did for the client credentials flow tutorial, let’s go back to the Konnect control plane to apply the OIDC plugin and then implement the authorization code flow.

  1. Set the Config.Client ID.Kong OIDC Client ID Setup
  2. Enter the Config.Client Secret.Kong OIDC client secret setup
  3. Add Okta’s Config.Issuer endpoint.Kong OIDC issuer setup
  4. Click Create to enable the OIDC plugin to the route.

Test the OpenID Connect Plugin

If we try to consume the route again, Kong redirects us to Okta’s user interface to present our credentials.

Okta user credential sign on

Once we have presented our correct credentials, Okta authenticates and redirects us back to the API gateway. At this time, we’ll consume the API because we got the identity token injected inside our request.

Kong and Okta Identity Token

Then we go to jwt.io to check the token.

JWT check Kong and Okta OIDC token

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 authorization code flow for user authentication, 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)

Kong KonnectOAuthOpen Source

More on this topic

Videos

PEXA’s Resilient API Platform on Kong Konnect

Videos

MCP vs OpenAPI vs A2A vs ?: Preparing for the Agentic World

See Kong in action

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

Get a Demo
Topics
Kong KonnectOAuthOpen Source
Share on Social
Claudio Acquaviva
Principal Architect, Kong

Recommended posts

How and Why to Migrate from Kong Open Source to Kong Konnect

Kong Logo
EngineeringMarch 1, 2023

Kong Konnect is a powerful SaaS-based API lifecycle management platform that provides a fast path for people looking to get started with Kong API Gateway. For existing users of Kong’s open-source gateway, it offers a way to rapidly take advantage of

Jerry Hency

Kong AI/MCP Gateway and Kong MCP Server Technical Breakdown

Kong Logo
EngineeringDecember 11, 2025

In the latest Kong Gateway 3.12 release , announced October 2025, specific MCP capabilities have been released: AI MCP Proxy plugin: it works as a protocol bridge, translating between MCP and HTTP so that MCP-compatible clients can either call exi

Jason Matis

AI Voice Agents with Kong AI Gateway and Cerebras

Kong Logo
EngineeringNovember 24, 2025

Kong Gateway is an API gateway and a core component of the Kong Konnect platform . Built on a plugin-based extensibility model, it centralizes essential functions such as proxying, routing, load balancing, and health checking, efficiently manag

Claudio Acquaviva

Farewell Ingress NGINX: Explore a Better Path Forward with Kong

Kong Logo
EngineeringNovember 14, 2025

"To prioritize the safety and security of the ecosystem, Kubernetes SIG Network and the Security Response Committee are announcing the upcoming retirement of Ingress NGINX . Best-effort maintenance will continue until March 2026. Afterward, there w

Justin Davies

Merge API Management & Identity to Unlock Your API Platform's Potential

Kong Logo
EnterpriseOctober 7, 2025

The challenge: A disconnected world Consider the typical enterprise architecture in a relatively mature organization, an API management layer defines and deploys services to an API gateway, an Identity Provider (IDP) manages human user identities, a

Dan Temkin

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

Level Up Your Digital Health Platform with Kong, SMART on FHIR, Okta

Kong Logo
EngineeringSeptember 2, 2025

The golden triangle: Kong, Okta, and FHIR Together, these three technologies enable healthcare organizations to connect systems with confidence, manage identities responsibly, and share data securely. FHIR Server: Your source of truth. It houses th

Biswa Mohanty

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 Konnect
    • Kong Gateway
    • Kong AI Gateway
    • Kong Insomnia
    • Developer Portal
    • Gateway Manager
    • Cloud Gateway
    • Get a Demo
    • Explore More
    • Open Banking API Solutions
    • API Governance Solutions
    • Istio API Gateway Integration
    • Kubernetes API Management
    • API Gateway: Build vs Buy
    • Kong vs Postman
    • Kong vs MuleSoft
    • Kong vs Apigee
    • Documentation
    • Kong Konnect Docs
    • Kong Gateway Docs
    • Kong Mesh Docs
    • Kong AI Gateway
    • Kong Insomnia Docs
    • Kong Plugin Hub
    • Open Source
    • Kong Gateway
    • Kuma
    • Insomnia
    • Kong Community
    • Company
    • About Kong
    • Customers
    • Careers
    • Press
    • Events
    • Contact
    • Pricing
  • Terms
  • Privacy
  • Trust and Compliance
  • © Kong Inc. 2026