By NHI Mgmt Group Editorial TeamBased on Curity: “APIs” (May 5, 2026)

TL;DR: API examples show how teams can apply OAuth tokens, JWT validation, client assertions, and mTLS across common languages and frameworks to secure APIs, serverless functions, and event-driven integrations, according to Curity. The practical message is that API security still depends on explicit identity controls, not framework convenience.


At a glance

What this is: This is a Curity article collection on securing APIs with OAuth tokens, JWTs, client assertions, and mTLS in common development stacks.

Why it matters: It matters because API security teams need implementation patterns that tie application code to identity controls instead of relying on framework defaults or assumed trust.


Context

API security depends on how requests are authenticated, authorised, and bound to the calling application, not just on whether a framework can parse a token. In practice, JWT validation, client assertions, and mTLS are identity controls embedded in code paths, which means implementation details directly shape trust.

This article is useful because it shows the same security problem across several language and runtime examples. That makes the underlying governance question clearer for IAM and API security teams: which trust assumptions are enforced by the application itself, and which are left to convenience features or defaults?

The primary concern here is how teams keep OAuth-secured APIs from becoming loosely governed access points. The examples are typical of modern API development, where security is often present in the stack but incomplete in the access model.


Key questions

Q: How should teams secure JWT-based APIs without relying on framework defaults?

A: Teams should define a minimum validation standard for every JWT-secured API, including issuer, audience, expiry, signature, and scope checks. The application must reject tokens that are syntactically valid but contextually wrong. Central policy matters because inconsistent token handling across stacks creates hidden trust gaps that attackers can exploit.

Q: When should organisations add client assertions or mTLS to OAuth APIs?

A: They should add stronger caller binding when bearer token replay would be costly, such as in B2B APIs, privileged service-to-service flows, or high-value integrations. Client assertions prove possession of a private key, while mTLS ties the request to a certificate-backed connection. Both reduce the usefulness of stolen tokens.

Q: What breaks when serverless APIs validate identity only at the first hop?

A: Downstream functions or event consumers can inherit trust they should not have, especially when a token is reused without rechecking audience or scope. That creates a mismatch between ingress controls and actual processing rights. The result is broader access than the original request intended, which weakens containment.

Q: What is the difference between bearer tokens and proof-of-possession tokens in administrative access flows?

A: Bearer tokens grant access to whoever presents them, so theft alone is enough for misuse. Proof-of-possession tokens add a cryptographic binding to the client, usually through a private key and request signature. That means an intercepted token is not enough on its own. For administrative sessions, this difference materially reduces replay risk and limits the damage from exposed support artifacts.


Technical breakdown

How JWT-secured APIs validate caller identity and claims

JWT-secured APIs use signed tokens to carry claims about the caller, the audience, and the granted scope. The API must validate signature, issuer, audience, expiry, and intended use before treating the token as proof of identity or authorisation. In practice, the security boundary is not the presence of a JWT but the correctness of every validation step. If the API accepts tokens too broadly, skips audience checks, or trusts unsigned claims, it turns a portable credential into an unsafe access mechanism.

Practical implication: require explicit token validation rules for every API entry point instead of relying on framework defaults.

Why client assertions and mTLS strengthen OAuth API trust

Client assertions and mutual TLS add stronger binding between the client and the credential it presents. A client assertion proves the application possesses a private key, while mTLS binds the request to a certificate-backed transport identity. That matters when bearer tokens alone are too easy to replay or forward. These controls do not replace OAuth. They narrow the trust window by making the caller harder to impersonate and by reducing the value of a stolen token outside its intended context.

Practical implication: use proof-of-possession patterns for high-value APIs where bearer token replay would be unacceptable.

How event-driven and serverless APIs change token enforcement

Event-driven and serverless systems often validate identity per invocation rather than through a long-lived session. That shifts the burden to each function, consumer, or message handler to check token scope, token freshness, and expected caller context. The risk is drift between the outer application architecture and the inner enforcement point. A token that is acceptable at ingestion may be unsafe downstream if handlers reuse it without rechecking intended audience or task scope.

Practical implication: enforce token checks at every processing boundary, including functions and event consumers.


NHI Mgmt Group analysis

API security is still an identity governance problem, not a framework feature. The article’s examples show that secure APIs depend on explicit decisions about who or what is allowed to act, under which proof, and for what scope. When those decisions are buried inside code samples, organisations risk treating identity enforcement as a developer convenience instead of a control plane. The practitioner lesson is to govern API authentication and authorisation as part of IAM architecture, not as an isolated coding task.

Token format is not trust. JWTs can carry useful claims, but a valid-looking token does not prove the right caller, the right audience, or the right delegation path unless the application checks those properties. This is the same control failure that appears whenever teams confuse credential presentation with credential assurance. The implication for practitioners is to separate token acceptance from trust validation in every API design review.

Proof-of-possession controls matter where bearer tokens are too transferable. Client assertions and mTLS reduce replay risk by binding identity more tightly to the client or transport. That makes them especially relevant in B2B APIs, serverless execution, and integration-heavy architectures where tokens move across systems. The broader signal is that API security is shifting from simple token checking toward stronger identity binding at the edge of each request.

API access patterns increasingly demand lifecycle thinking, not one-off integration logic. A secure example in one language does not solve the governance problem if the same token model is reused across environments, frameworks, and event consumers without consistent policy. That creates hidden variance in how identity is enforced. The practitioner conclusion is that identity controls for APIs need lifecycle ownership, inventory, and review across the full integration estate.

API security coding examples create the right starting point, but the control model still has to be designed centrally. Teams that scatter authentication logic across application teams eventually get policy drift, inconsistent scope handling, and uneven replay protection. That is why API security and IAM teams need shared standards for token validation, client authentication, and message-bound identity checks. The practical outcome is more consistent enforcement across runtime patterns.

From our research library:

What this signals

API security programmes increasingly fail at the boundary between token issuance and token enforcement. Token trust drift: the closer identity logic is embedded in code samples, the easier it is for teams to let validation rules diverge across services, languages, and deployment models.

The practical signal for IAM leaders is that OAuth-secured APIs need lifecycle governance, not just implementation guidance. Token format, caller binding, and downstream enforcement all have to be reviewed as a single policy surface, otherwise each integration team becomes its own security authority.


For practitioners

  • Standardise JWT validation rules Define required checks for issuer, audience, expiry, signature, and scope so that each API validates tokens consistently instead of trusting framework defaults.
  • Bind high-value APIs to stronger caller proof Use client assertions or mTLS where token replay would create unacceptable exposure, especially in B2B integrations and privileged service-to-service flows.
  • Review serverless and event handlers separately Check each function or consumer for its own token enforcement logic, because downstream handlers can accidentally widen access if they reuse upstream trust.
  • Inventory API identity patterns across stacks Map where OAuth tokens, JWTs, and certificate-based authentication are used so policy, revocation, and logging can be governed across the full integration estate.

Key takeaways

  • API security examples are only useful when they translate into consistent identity controls across languages, runtimes, and integration styles.
  • JWTs, client assertions, and mTLS each address a different part of the trust problem, especially where token replay or scope drift would be damaging.
  • Teams need governance over token validation and enforcement boundaries, or serverless and event-driven systems will silently expand access.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 and OWASP API Security Top 10 address the attack and risk surface, while NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-04 — Insecure AuthenticationJWT validation and client authentication are the central trust controls in these API examples.
NHI-10 — Human Use of NHIAPI token handling often fails when humans and applications share or copy credentials informally.
Recommendation — Require strict token validation and caller authentication for every OAuth-secured API. Separate human and application credential use so API tokens are never handled like user login material.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementJWTs, client assertions, and certificate-backed trust all depend on managed authenticators.
Recommendation — Apply authenticator lifecycle controls to rotate, revoke, and validate API credentials consistently.
OWASP API Security Top 10API2 — Broken AuthenticationThe article focuses on preventing API authentication errors and replayable token abuse.
Recommendation — Test API endpoints for broken authentication paths and reject tokens that are valid but out of context.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsThe examples show why every API needs explicit authorization checks, not only token acceptance.
Recommendation — Map API access decisions to PR.AA-05 so entitlement checks are enforced at the application boundary.

Key terms

  • JWT-secured API: An API that uses JSON Web Tokens to carry authenticated claims about the caller and the request context. Security depends on validating signature, audience, expiry, issuer, and scope before the token is accepted as proof of access.
  • Client Assertion: A client assertion is a signed proof that the caller is the intended application or workload. It strengthens machine authentication by binding the request to cryptographic evidence rather than simple token possession. That makes it useful where replay risk or privileged access would be unacceptable.
  • Mutual Tls: Mutual TLS is a transport security method where both client and server present certificates and authenticate each other. In implant frameworks, it helps prevent impersonation, supports encrypted sessions, and ties each deployment to its own trust material rather than shared credentials.
  • Token Validation: Token validation is the process of checking that a credential was issued by the right authority, has not expired, and is meant for the current request. For NHIs, validation must include issuer, audience, signature, scope, and context, otherwise a valid token can still be over-privileged.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on July 6, 2026.
Updated on October 11, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org