A2a authentication

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

A2a authentication is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Implement A2A authentication — API keys, Bearer tokens, OAuth 2.0, OpenID Connect, and mutual TLS. Use when securing agent-to-agent communication and configuring Agent Card security schemes.

How to use this skill

Skill file

A2A Authentication

Before writing code

Fetch live docs:

  1. Fetch https://a2a-protocol.org/latest/specification/ for the authentication and security section
  2. Web-search site:github.com a2aproject A2A authentication security schemes for auth scheme details
  3. Web-search site:github.com a2aproject a2a-samples authentication for auth implementation examples
  4. Fetch SDK docs for authentication middleware and client credential handling

Conceptual Architecture

Why Authentication Matters

In multi-agent systems, agents must verify each other's identity and authorize access:

Five Security Schemes

A2A supports the same security scheme types as OpenAPI 3.0:

1. API Key (`apiKey`)

A static key sent in a header or query parameter.

2. HTTP Bearer (`http` with `scheme: bearer`)

A bearer token (JWT or opaque) in the Authorization header.

3. OAuth 2.0 (`oauth2`)

Standard OAuth 2.0 flows for token acquisition.

Common flow for agent-to-agent: Client Credentials (machine-to-machine, no user involvement).

4. OpenID Connect (`openIdConnect`)

OIDC discovery-based authentication.

5. Mutual TLS (`mutualTLS`)

Client certificate-based authentication.

Agent Card Authentication Declaration

Authentication requirements are declared in the Agent Card using two top-level fields, securitySchemes (a map of named scheme definitions) and security (an array of required scheme references):

{
  "securitySchemes": {
    "oauth2_auth": {
      "type": "oauth2",
      "flows": {
        "clientCredentials": {
          "tokenUrl": "https://auth.example.com/token",
          "scopes": {
            "agent:read": "Read access",
            "agent:write": "Write access"
          }
        }
      }
    }
  },
  "security": [
    { "oauth2_auth": [] }
  ]
}

Extended Agent Card

The agent/authenticatedExtendedCard method allows agents to return a richer Agent Card to authenticated clients — exposing additional skills or capabilities that aren't visible to unauthenticated discovery.

Auth-Required State

If a task requires authentication mid-flow:

  1. Server transitions task to auth-required state
  2. Status message includes auth instructions
  3. Client authenticates and resumes the task
  4. Server transitions back to working

Best Practices

Fetch the specification for exact authentication schema structures, security scheme field names, and the extended card method before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.