Skip to content

.NET: [Bug]: MapA2A().RequireAuthorization() does nothing? #3645

@AndreasKlauber

Description

@AndreasKlauber

Description

When implementing the MapA2A method on my agent:

The RequireAuthorization() part seems to nothing and my request passes to the agent even without any bearer token. Am I implementing it incorrectly or does this not work?

Code Sample

app.MapA2A(
        agent,
        path: "/a2a",
        agentCard: agentCard,
        taskManager => app.MapWellKnownAgentCard(taskManager, "/a2a"))
        .RequireAuthorization();

Error Messages / Stack Traces

Package Versions

<PackageReference Include="Microsoft.Agents.AI.A2A" Version="1.0.0-preview.260121.1" />     <PackageReference Include="Microsoft.Agents.AI.AzureAI" Version="1.0.0-preview.260121.1" />     <PackageReference Include="Microsoft.Agents.AI.Hosting.A2A" Version="1.0.0-preview.260121.1" />     <PackageReference Include="Microsoft.Agents.AI.Hosting.A2A.AspNetCore" Version="1.0.0-preview.260121.1" />     <PackageReference Include="Microsoft.Agents.AI.OpenAI" Version="1.0.0-preview.260121.1" />     <PackageReference Include="Azure.AI.Agents.Persistent" Version="1.2.0-beta.8" /> 	<PackageReference Include="Microsoft.Agents.AI.AGUI" Version="1.0.0-preview.260121.1" /> 	<PackageReference Include="Microsoft.Agents.AI.DevUI" Version="1.0.0-preview.260121.1" /> 	<PackageReference Include="Microsoft.Agents.AI.Hosting.AGUI.AspNetCore" Version="1.0.0-preview.260121.1" />

.NET Version

.NET 10.0

Additional Context

Request:
POST {{HostAddress}}/a2a
Content-Type: application/json

{
"id": "1",
"jsonrpc": "2.0",
"method": "message/send",
"params": {
"id": "task_001",
"message": {
"kind": "message",
"role": "user",
"messageId": "msg_001",
"parts": [
{
"kind": "text",
"text": "Hello"
}
]
}
}
}

Response:
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"kind": "message",
"role": "agent",
"parts": [
{
"kind": "text",
"text": "Hello! How can I assist you today?"
}
],
"messageId": "chatcmpl-D5Bg0XqsgLhIAwMkWzwHzXiaT3D8B",
"contextId": "1545bc9a6c924c70a355261388979882"
}
}

Metadata

Metadata

Assignees

Labels

.NETa2aIssue relates to A2AbugSomething isn't workingv1.0Features being tracked for the version 1.0 GA

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions