Definition
Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.Outbound Inheritance: System.ObjectSyntax
Summary
Runs the RFC 8628 device authorization grant: start the grant at the device authorization endpoint, then poll the token endpoint honoringinterval, slow_down, and authorization_pending
until a token is issued, the code expires, or the end user denies it.
Remarks
Perspecs/v3/AUTHENTICATION.md “Grants → Device code (RFC 8628)” the
device_authorization_endpoint from metadata is always preferred; {issuer}/devicecode is a
last-resort fallback, logged at Warning, used only when the server advertises the device code grant but
publishes no endpoint for it. Per AUTH-12 the device code, user code, and every issued token stay
out of the log: poll entries carry only the attempt number and the RFC error code. The device
authorization request goes out on the "OAuth" named client directly; every token POST goes
through TokenEndpointClient so that all token traffic in this package shares one code path.
Examples
Constructors
.ctor
Initializes a new instance of the DeviceCodeGrant class.Syntax
Parameters
Exceptions
.ctor Inherited
Inherited from
objectSyntax
Methods
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
PollAsync
Polls the token endpoint until the end user completes the grant, the device code expires, or the request is cancelled.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Outbound.TokenEndpointResponse>
The successful token response.
Exceptions
Examples
Remarks
The first wait is DeviceAuthorizationResponse.Interval seconds, floored at one second so a server that advertises zero cannot turn this into a hot loop; eachslow_down adds
DeviceCodeGrant.SlowDownIncrementSeconds seconds for the rest of the grant, per RFC 8628 section 3.5.
The deadline is computed once from DeviceAuthorizationResponse.ExpiresIn at the first
poll, so a slow server cannot extend the code’s life.
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
StartAsync
Starts a device authorization grant and returns the codes the end user needs.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Outbound.DeviceAuthorizationResponse>
The device authorization response, whose device code, user code, and verification URI are guaranteed
non-empty.
Exceptions
Remarks
scope and resource are sent only when supplied, so a server that rejects an emptyscope or an unexpected resource never sees either.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?