WHY GARTNER’S “CONTEXT MESH” CHANGES EVERYTHING AI CONNECTIVITY: THE ROAD AHEAD DON’T MISS API + AI SUMMIT 2026 SEPT 30 – OCT 1
  • [Why Kong](/company/why-kong)Why Kong
    • Explore the unified API Platform
        • BUILD APIs
        • [
          Kong Insomnia](/products/kong-insomnia)
          Kong Insomnia
        • [
          API Design](/products/kong-insomnia/api-design)
          API Design
        • [
          API Mocking](/products/kong-insomnia/api-mocking)
          API Mocking
        • [
          API Testing and Debugging](/products/kong-insomnia/api-testing-and-debugging)
          API Testing and Debugging
        • [
          MCP Client](/products/kong-insomnia/mcp-client)
          MCP Client
        • RUN APIs
        • [
          API Gateway](/products/kong-gateway)
          API Gateway
        • [
          Context Mesh](/products/kong-konnect/features/context-mesh)
          Context Mesh
        • [
          AI Gateway](/products/kong-ai-gateway)
          AI Gateway
        • [
          Event Gateway](/products/event-gateway)
          Event Gateway
        • [
          Kubernetes Operator](/products/kong-gateway-operator)
          Kubernetes Operator
        • [
          Service Mesh](/products/kong-mesh)
          Service Mesh
        • [
          Ingress Controller](/products/kong-ingress-controller)
          Ingress Controller
        • [
          Runtime Management](/products/kong-konnect/features/runtime-management)
          Runtime Management
        • DISCOVER APIs
        • [
          Developer Portal](/products/kong-konnect/features/developer-portal)
          Developer Portal
        • [
          Service Catalog](/products/kong-konnect/features/api-service-catalog)
          Service Catalog
        • [
          MCP Registry](/products/mcp-registry)
          MCP Registry
        • GOVERN APIs
        • [
          Metering and Billing](/products/kong-konnect/features/usage-based-metering-and-billing)
          Metering and Billing
        • [
          APIOps and Automation](/products/apiops-automation)
          APIOps and Automation
        • [
          API Observability](/products/kong-konnect/features/api-observability)
          API Observability
        • [Why Kong?](/company/why-kong)Why Kong?
      • CLOUD
      • [Cloud API Gateways](/products/kong-konnect/features/dedicated-cloud-gateways)Cloud API Gateways
      • [Need a self-hosted or hybrid option?](/products/kong-enterprise)Need a self-hosted or hybrid option?
      • COMPARE
      • [Considering AI Gateway alternatives? ](/performance-comparison/ai-gateway-alternatives)Considering AI Gateway alternatives?
      • [Kong vs. Postman](/performance-comparison/kong-vs-postman)Kong vs. Postman
      • [Kong vs. MuleSoft](/performance-comparison/kong-vs-mulesoft)Kong vs. MuleSoft
      • [Kong vs. Apigee](/performance-comparison/kong-vs-apigee)Kong vs. Apigee
      • [Kong vs. IBM](/performance-comparison/ibm-api-connect-vs-kong)Kong vs. IBM
      • GET STARTED
      • [Sign Up for Kong Konnect](/products/kong-konnect/register)Sign Up for Kong Konnect
      • [Documentation](https://developer.konghq.com/)Documentation
      • FOR PLATFORM TEAMS
      • [Developer Platform](/solutions/building-developer-platform)Developer Platform
      • [Kubernetes and Microservices](/solutions/build-on-kubernetes)Kubernetes and Microservices
      • [Observability](/solutions/observability)Observability
      • [Service Mesh Connectivity ](/solutions/service-mesh-connectivity)Service Mesh Connectivity
      • [Kafka Event Streaming](/solutions/kafka-stream-api-management)Kafka Event Streaming
      • FOR EXECUTIVES
      • [AI Connectivity](/ai-connectivity)AI Connectivity
      • [Open Banking](/solutions/open-banking)Open Banking
      • [Legacy Migration](/solutions/legacy-api-management-migration)Legacy Migration
      • [Platform Cost Reduction](/solutions/api-platform-consolidation)Platform Cost Reduction
      • [Kafka Cost Optimization](/solutions/reduce-kafka-cost)Kafka Cost Optimization
      • [API Monetization](/solutions/api-monetization)API Monetization
      • [AI Monetization](/solutions/ai-monetization)AI Monetization
      • [AI FinOps](/solutions/ai-cost-governance-finops)AI FinOps
      • FOR AI TEAMS
      • [AI Governance](/solutions/ai-governance)AI Governance
      • [AI Security](/solutions/ai-security)AI Security
      • [AI Cost Control](/solutions/ai-cost-optimization-management)AI Cost Control
      • [Agentic Infrastructure](/solutions/agentic-ai-workflows)Agentic Infrastructure
      • [MCP Production](/solutions/mcp-production-and-consumption)MCP Production
      • [MCP Traffic Gateway](/solutions/mcp-governance)MCP Traffic Gateway
      • FOR DEVELOPERS
      • [Mobile App API Development](/solutions/mobile-application-api-development)Mobile App API Development
      • [GenAI App Development](/solutions/power-openai-applications)GenAI App Development
      • [API Gateway for Istio](/solutions/istio-gateway)API Gateway for Istio
      • [Decentralized Load Balancing](/solutions/decentralized-load-balancing)Decentralized Load Balancing
      • BY INDUSTRY
      • [Financial Services](/solutions/financial-services-industry)Financial Services
      • [Healthcare](/solutions/healthcare)Healthcare
      • [Higher Education](/solutions/api-platform-for-education-services)Higher Education
      • [Insurance](/solutions/insurance)Insurance
      • [Manufacturing](/solutions/manufacturing)Manufacturing
      • [Retail](/solutions/retail)Retail
      • [Software & Technology](/solutions/software-and-technology)Software & Technology
      • [Transportation](/solutions/transportation-and-logistics)Transportation
      • [See all Solutions](/solutions)See all Solutions
  • [Pricing](/pricing)Pricing
      • DOCUMENTATION
      • [Kong Konnect](https://developer.konghq.com/konnect/)Kong Konnect
      • [Kong Gateway](https://developer.konghq.com/gateway/)Kong Gateway
      • [Kong Mesh](https://developer.konghq.com/mesh/)Kong Mesh
      • [Kong AI Gateway](https://developer.konghq.com/ai-gateway/)Kong AI Gateway
      • [Kong Event Gateway](https://developer.konghq.com/event-gateway/)Kong Event Gateway
      • [Kong Insomnia](https://developer.konghq.com/insomnia/)Kong Insomnia
      • [Plugin Hub](https://developer.konghq.com/plugins/)Plugin Hub
      • EXPLORE
      • [Blog](/blog)Blog
      • [Learning Center](/blog/learning-center)Learning Center
      • [eBooks](/resources/e-book)eBooks
      • [Reports](/resources/reports)Reports
      • [Demos](/resources/demos)Demos
      • [Customer Stories](/customer-stories)Customer Stories
      • [Videos](/resources/videos)Videos
      • EVENTS
      • [API + AI Summit](/events/conferences/api-ai-summit)API + AI Summit
      • [Agentic Era World Tour](/agentic-era-world-tour)Agentic Era World Tour
      • [Webinars](/events/webinars)Webinars
      • [User Calls](/events/user-calls)User Calls
      • [Workshops](/events/workshops)Workshops
      • [Meetups](/events/meetups)Meetups
      • [See All Events](/events)See All Events
      • FOR DEVELOPERS
      • [Get Started](https://developer.konghq.com/)Get Started
      • [Community](/community)Community
      • [Certification](/academy/certification)Certification
      • [Training](https://education.konghq.com)Training
      • COMPANY
      • [About Us](/company/about-us)About Us
      • [We're Hiring!](/company/careers)We're Hiring!
      • [Press Room](/company/press-room)Press Room
      • [Contact Us](/company/contact-us)Contact Us
      • [Kong Partner Program](/partners)Kong Partner Program
      • [Enterprise Support Portal](https://support.konghq.com/s/)Enterprise Support Portal
      • [Documentation](https://developer.konghq.com/?_gl=1*tphanb*_gcl_au*MTcxNTQ5NjQ0MC4xNzY5Nzg4MDY0LjIwMTI3NzEwOTEuMTc3MzMxODI2MS4xNzczMzE4MjYw*_ga*NDIwMDU4MTU3LjE3Njk3ODgwNjQ.*_ga_4JK9146J1H*czE3NzQwMjg1MjkkbzE4OSRnMCR0MTc3NDAyODUyOSRqNjAkbDAkaDA)Documentation
  • [](/search)
  • [Login](https://cloud.konghq.com/login)Login
  • [Book Demo](/contact-sales)Book Demo
  • [Get Started](/products/kong-konnect/register)Get Started
[Blog](/blog)Blog
  • [AI Gateway](/blog/tag/ai-gateway)AI Gateway
  • [AI Security](/blog/tag/ai-security)AI Security
  • [AIOps](/blog/tag/aiops)AIOps
  • [API Security](/blog/tag/api-security)API Security
  • [API Gateway](/blog/tag/api-gateway)API Gateway
|
    • [API Management](/blog/tag/api-management)API Management
    • [API Development](/blog/tag/api-development)API Development
    • [API Design](/blog/tag/api-design)API Design
    • [Automation](/blog/tag/automation)Automation
    • [Service Mesh](/blog/tag/service-mesh)Service Mesh
    • [Insomnia](/blog/tag/insomnia)Insomnia
    • [Event Gateway](/blog/tag/event-gateway)Event Gateway
    • [View All Blogs](/blog/page/1)View All Blogs
We're Entering the Age of AI Connectivity [Read more](/blog/news/the-age-of-ai-connectivity)Read moreProducts & Agents:
    • [Kong AI Gateway](/products/kong-ai-gateway)Kong AI Gateway
    • [Kong API Gateway](/products/kong-gateway)Kong API Gateway
    • [Kong Event Gateway](/products/event-gateway)Kong Event Gateway
    • [Kong Metering & Billing](/products/usage-based-metering-and-billing)Kong Metering & Billing
    • [Kong Insomnia](/products/kong-insomnia)Kong Insomnia
    • [Kong Konnect](/products/kong-konnect)Kong Konnect
  • [Documentation](https://developer.konghq.com)Documentation
  • [Book Demo](/contact-sales)Book Demo
  1. Home
  2. Blog
  3. Learning Center
  4. Understanding Microservices Authentication Services
[Learning Center](/blog/learning-center)Learning Center
March 10, 2022
5 min read

# Understanding Microservices Authentication Services

Kong

#### The distributed setup of a microservice application not only increases the potential attack surface of your application but also adds a new layer of complexity to authentication, authorization and session management. Here, we explore the options available.

Authentication is the process of determining who a user is by, for example, asking them to provide a username and password or using multi-factor authentication. Once you know who the user is, you can check their account details to determine what they are authorized to access. Creating a session for an authenticated user preserves their current state and avoids them having to log in repeatedly in order to determine whether they are authorized to access a requested resource.

In a traditional, [monolith-style web application](https://konghq.com/blog/learning-center/monolith-vs-microservices)monolith-style web application, user authentication and session management are relatively simple: once authenticated, a session is created and stored on the server, where it can be accessed by any components that require it and used to inform and authorize subsequent requests. A session ID is sent to the client and used in all subsequent requests to the application to associate the request with the current session.

With a [microservices](https://konghq.com/blog/learning-center/what-are-microservices)microservices-based application, services are designed to be self-contained and stateless so they can be deployed separately and scaled across multiple servers or containers. A different approach to authentication and session management is needed to ensure a scalable architecture.

## Authenticating Microservices Requests

Rather than implement authentication logic in each microservice that makes up the application (which would mean replicating the same logic in every language or framework used by the application), most microservice-based applications include a dedicated authentication service. When a request is received, the authentication service is queried to ensure the user is authenticated and authorized before the request is processed by the relevant microservices.

Although it's possible to authenticate each request to an application by including the username and password in the HTTP header, basic authentication is not secure and risks exposing your users' data to attackers. HMAC authentication sends a hashed version of the password in the header for comparison against a plain text password stored on the server, making the server a security risk. By contrast, token-based authentication avoids sending credentials in the request header and provides a time-limited authentication mechanism.

With token-based authentication, if a request is received and the user is not currently authenticated, they are redirected to the authentication service where they enter their credentials. Once authenticated, an access token is generated and sent to the client which stores it as a cookie. The client then includes the token with each subsequent request to show that the user has already been authenticated. For each request, the access token is checked against the authentication service before being processed by the relevant service. Once the token has expired or been revoked, the user is no longer authenticated.

For security reasons, the access token should be as meaningless as possible to anyone who might intercept it; it should simply act as an identifier for the authentication service to check whether the request has come from an authorized user. This means session information cannot be included in the access token and must be stored somewhere else.

## Distributed Session Management in Microservices

The traditional monolith approach to session management involves storing the user's session data on the server side. In a microservice application, the authentication service described above can provide a session ID for the client to include in subsequent requests. However, when services are distributed across multiple containers or servers, accessing server-side session data poses a potential problem.

One option is to set up a central data store that can be accessed by all the microservices. The data store must be secured and replicated for high availability to avoid a single point of failure. Alternatively, if instances of all necessary services are available on a single server, sticky sessions can be used to ensure all requests from the same user go to the same server. Session data is only stored on the selected server, where it is accessed as needed. However, this approach is vulnerable to the server failing or spikes in traffic forcing the load balancer to direct traffic to a different server, losing the user's session data. A further alternative is to replicate the session store across all servers. This can work well for smaller deployments, but there can be a significant impact on network bandwidth and ultimately performance when scaled across large numbers of servers.

## Session Tokens with an API Gateway

An [API gateway](https://konghq.com/blog/learning-center/what-is-an-api-gateway)API gateway not only provides a single access point for your application's APIs - it can also provide authentication and session management. The authentication service described above can be implemented at the API gateway level to identify users and generate an access token for the client to include in future requests. On receiving a request, the API gateway checks the access token with the authentication service, which (if the user is still authenticated) returns a [JSON web token](https://konghq.com/blog/jwt-kong-gateway)JSON web token (JWT) containing details of the user's session. The API gateway then forwards the request with the JWT to the relevant microservices, providing them with the user's session data. The response from the microservices is routed via the API gateway, which updates the session information as required and replaces the JWT with the access token shared with the client before the response.

This approach enables a stateless architecture, with session details included as part of each request. Limiting the JWT containing session details to communications upstream from the API gateway ensures that those details are protected by the security measures applied to the application and are less likely to be intercepted by a malicious actor. Furthermore, when a user logs out, their session can no longer be accessed from the server side, as the corresponding access token has been revoked.

## OAuth and Authenticating with Third-Party Applications

It's increasingly common for third-party applications to request access to an application on behalf of a user, such as posting from an app to a social media account. Asking the user to enter their account login details into the third party application is bad practice, as it increases the potential attack surface. One alternative is to provide the user with an [API key](https://docs.konghq.com/hub/kong-inc/key-auth)API key to use instead of their credentials, but an API key in a request is still open to interception by attackers. The preferred approach is to use [OAuth](https://konghq.com/blog/learning-center/what-is-oauth)OAuth, which uses tokens to identify requests from the user.

## Authentication and Session Management with Kong

Applying authentication and session management at the API gateway ensures a consistent approach across your APIs. The [Kong API gateway](https://konghq.com/kong)Kong API gateway supports a range of [plugins](https://docs.konghq.com/hub/)plugins for authentication and session management, so you can choose the appropriate solution for your application.

- [Microservices](/blog/tag/microservices)Microservices- [API Authentication](/blog/tag/api-authentication)API Authentication- [API Authorization](/blog/tag/api-authorization)API Authorization

## More on this topic

_Videos_

## From Pattern to Practice: Scalable API Authorization in Distributed Microservices

_eBooks_

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

## See Kong in action

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

[Get a Demo](/contact-sales)Get a Demo
**Topics**
- [Microservices](/blog/tag/microservices)Microservices- [API Authentication](/blog/tag/api-authentication)API Authentication- [API Authorization](/blog/tag/api-authorization)API Authorization
Kong

Recommended posts

# RBAC Explained: The Basics of Role-Based Access Control

[Learning Center](/blog)Learning CenterApril 14, 2025

As cybersecurity takes the main stage, organizations face a significant challenge: how do you strike a balance between maintaining a high level of security and ensuring employees have enough data access to perform their jobs properly?  Role-based ac

Kong
[](https://konghq.com/blog/learning-center/what-is-rbac)

# What are API Keys? Overview and Use Cases

[Learning Center](/blog)Learning CenterMay 22, 2023

Application programming interfaces (APIs) allow software to communicate and share data. But how can those APIs confirm the identity of the clients theyre communicating with? API keys are one solution. API keys are unique codes for authenticating and

Eric Pulsifer
[](https://konghq.com/blog/learning-center/what-are-api-keys)

# What is OAuth?

Kong Logo
[Learning Center](/blog)Learning CenterJanuary 26, 2023

OAuth (short for Open Authorization) is a popular, standardized API protocol that provides a secure way for services to quickly share resources for a seamless user experience. Examples of OAuth in action include giving a greeting card service acce

Kong
[](https://konghq.com/blog/learning-center/what-is-oauth)

# API Gateway Authentication

Kong Logo
[Learning Center](/blog)Learning CenterApril 19, 2022

API gateway authentication is an important way to control the data that is allowed to be transmitted using your APIs. What is an API Gateway? In essence, it authenticates that a particular consumer has permission to access the API, using a predefin

Kong
[](https://konghq.com/blog/learning-center/api-gateway-authentication)

# How to Implement Secure Access Control with OPA and Kong Gateway

[Engineering](/blog)EngineeringJanuary 8, 2025

Ensuring secure access to applications and APIs is critical. As organizations increasingly adopt microservices architectures and cloud native solutions, the need for robust, fine-grained access control mechanisms becomes paramount. This is where the

Raja Ravi Varman
[](https://konghq.com/blog/engineering/secure-access-control-with-opa-and-kong)

# Adopt a Zero Trust Approach with OAuth 2.0 Mutual TLS Client Authentication

[Engineering](/blog)EngineeringFebruary 19, 2024

In the modern IT stack, API gateways act as the first line of defense against attacks on backend services by enforcing authentication/authorization policies and validating and transforming requests. When backend services are protected with a token-b

Samuele Illuminati
[](https://konghq.com/blog/engineering/zero-trust-oauth-2-0-mtls-client-authentication)

# Understanding Microsegmentation in Zero Trust Security

[Engineering](/blog)EngineeringFebruary 6, 2024

With digital transformation shifting networks into the cloud — from remote workforces to online banking — cyberattacks are growing more prevalent and sophisticated. Legacy security models like VPNs and perimeter-based firewalls are proving inadequat

Kong
[](https://konghq.com/blog/engineering/microsegmentation-and-zero-trust-security)

## 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](/contact-sales)Get a Demo
Ask AI for a summary of Kong
  • [](https://chatgpt.com/s/t_69b981cfa37081919ce25ce107c431c1)
  • [](https://share.google/aimode/hyefOiNwl8pg8W99d)
  • [](https://www.perplexity.ai/search/what-solutions-does-kong-offer-VsYWPddxQjajgvLA4B9hjQ)
Stay connected

## step-0

    • Company
    • [About Kong](/company/about-us)About Kong
    • [Customers](/customer-stories)Customers
    • [Careers](/company/careers)Careers
    • [Press](/company/press-room)Press
    • [Events](/events)Events
    • [Contact](/company/contact-us)Contact
    • [Pricing](/pricing)Pricing
    • Legal
    • [Terms](/legal/terms-of-use)Terms
    • [Privacy](/legal/privacy-policy)Privacy
    • [Trust and Compliance](https://trust.konghq.com)Trust and Compliance
    • Platform
    • [Kong AI Gateway](/products/kong-ai-gateway)Kong AI Gateway
    • [Kong Konnect](/products/kong-konnect)Kong Konnect
    • [Kong Gateway](/products/kong-gateway)Kong Gateway
    • [Kong Event Gateway](/products/event-gateway)Kong Event Gateway
    • [Kong Insomnia](/products/kong-insomnia)Kong Insomnia
    • [Documentation](https://developer.konghq.com)Documentation
    • [Book Demo](/contact-sales)Book Demo
    • Compare
    • [AI Gateway Alternatives](/performance-comparison/ai-gateway-alternatives)AI Gateway Alternatives
    • [Kong vs Apigee](/performance-comparison/kong-vs-apigee)Kong vs Apigee
    • [Kong vs IBM](/performance-comparison/ibm-api-connect-vs-kong)Kong vs IBM
    • [Kong vs Postman](/performance-comparison/kong-vs-postman)Kong vs Postman
    • [Kong vs Mulesoft](/performance-comparison/kong-vs-mulesoft)Kong vs Mulesoft
    • Explore More
    • [Open Banking API Solutions](/solutions/open-banking)Open Banking API Solutions
    • [API Governance Solutions](/solutions/api-governance)API Governance Solutions
    • [Istio API Gateway Integration](/solutions/istio-gateway)Istio API Gateway Integration
    • [Kubernetes API Management](/solutions/build-on-kubernetes)Kubernetes API Management
    • [API Gateway: Build vs Buy](/campaign/secure-api-scalability)API Gateway: Build vs Buy
    • [Kong vs Apigee](/performance-comparison/kong-vs-apigee)Kong vs Apigee
    • Open Source
    • [Kong Gateway](https://developer.konghq.com/gateway/install/)Kong Gateway
    • [Kuma](https://kuma.io/)Kuma
    • [Insomnia](https://insomnia.rest/)Insomnia
    • [Kong Community](/community)Kong Community

Kong enables the connectivity layer for the agentic era – securely connecting, governing, and monetizing APIs and AI tokens across any model or cloud.

  • Japanese
  • Frenchcoming soon
  • Spanishcoming soon
  • Germancoming soon
© Kong Inc. 2026
Interaction mode