Skip to content

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Page as Markdown

JWT authentication

Attaches to:

Route

JWT tokensJWT (JSON Web Token)A compact, URL-safe token format used for securely transmitting information between parties. JWTs are commonly used for authentication and authorization in agentgateway. from incoming requests can be verified.

JWT authentication requires a few parameters:

  • The issuer verifies that tokens come from the specified issuer (iss).
  • The audiences lists allowed audience values (aud)
  • The jwks defines the list of public keys to verify against.

Additionally, authentication can run in three different modes:

  • Strict: A valid token, issued by a configured issuer, must be present.
  • Optional (default): If a token exists, validate it.
    Warning: This allows requests without a JWT token!
  • Permissive: Requests are never rejected. This is useful for usage of claims in later steps (authorization, logging, etc).
    Warning: This allows requests without a JWT token!
jwtAuth:
  mode: strict
  issuer: agentgateway.dev
  audiences: [test.agentgateway.dev]
  jwks:
    # Relative to the folder the binary runs from, not the config file
    file: ./manifests/jwt/pub-key

It is common to pair jwtAuth with authorization, using the claims from the verified JWT. For example:

authorization:
  rules:
  - allow: 'request.path == "/admin" && jwt.groups.contains("admins")'
Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.