Table of Contents

Class AuthorizationResult

Namespace
ModelContextProtocol.Authentication
Assembly
ModelContextProtocol.Core.dll

Represents the result of an OAuth authorization redirect, containing the authorization code, state, and optionally the issuer identifier from the authorization response.

public sealed class AuthorizationResult
Inheritance
AuthorizationResult
Inherited Members

Remarks

The State property must be populated from the state query parameter in the redirect URI. The SDK validates it against the value sent in the authorization request to bind the response to the initiating transaction and mitigate cross-site request forgery attacks.

The Iss property should be populated from the iss query parameter in the redirect URI when present, as specified by RFC 9207. This enables the SDK to validate that the authorization response originated from the expected authorization server, mitigating mix-up attacks.

Properties

Code

Gets the authorization code returned by the authorization server.

public string? Code { get; init; }

Property Value

string

Iss

Gets the issuer identifier returned in the authorization response per RFC 9207.

public string? Iss { get; init; }

Property Value

string

Remarks

This value should be extracted from the iss query parameter of the redirect URI. When present, the SDK validates it against the expected authorization server issuer to prevent mix-up attacks.

Implementations of AuthorizationCallbackHandler should populate this property whenever the iss parameter is present in the redirect URI callback.

State

Gets the state value returned in the authorization response.

public string? State { get; init; }

Property Value

string

Remarks

Implementations of AuthorizationCallbackHandler must populate this property from the state query parameter of the redirect URI callback. The SDK requires an exact match with the state sent in the authorization request before exchanging the authorization code.