Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.Outbound Inheritance: System.Object

Syntax

Summary

Posts an RFC 6749 token request on the handler-free "OAuth" named HttpClient and turns the answer into either a TokenEndpointResponse or an OAuthTokenException. Every grant in this package — device code, refresh, authorization code, client credentials — sends its token request through this one class.

Remarks

A new "OAuth" client is requested from IHttpClientFactory on every call rather than cached, matching the “Two named HttpClients” table in specs/v3/AUTHENTICATION.md. Per AUTH-12 neither the request form, the response body, nor any credential is ever logged: the Debug entries carry only the endpoint, the grant_type, the token type, the lifetime, and whether a refresh token came back. Unlike well-known discovery, a token request is never retried here — a token POST is not idempotent and a failed grant is a decision for the caller, not a transport retry.

Examples

Constructors

.ctor

Initializes a new instance of the TokenEndpointClient class.

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from object

Syntax

Methods

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

PostAsync

Posts a token request and returns the RFC 6749 section 5.1 success response.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Outbound.TokenEndpointResponse> The parsed success response, whose TokenEndpointResponse.AccessToken is guaranteed non-empty.

Exceptions

Remarks

The RFC 8707 resource indicator and scope are the caller’s to place in form; this method never invents either, so a grant that must omit resource simply leaves it out. Cancellation requested through cancellationToken propagates as OperationCanceledException rather than being wrapped.

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?