Table of Contents

Method AuthorizeWithDeviceCodeAsync

Namespace
MailFathom.Common.MailboxOAuth
Assembly
MailFathom.Common.dll

AuthorizeWithDeviceCodeAsync(MailboxAuthorizationRequest, Action<DeviceCodePrompt>, CancellationToken)

Requests a device code, reports the prompt, and polls until the person completes the sign-in.

public Task<MailboxAuthorizationGrant> AuthorizeWithDeviceCodeAsync(MailboxAuthorizationRequest request, Action<DeviceCodePrompt> reportPrompt, CancellationToken cancellationToken)

Parameters

request MailboxAuthorizationRequest

The provider endpoints and registered client.

reportPrompt Action<DeviceCodePrompt>

Receives the code and address to show the person, once, before polling begins. Invoked on the calling thread, so whatever it writes has been written by the time the wait starts.

cancellationToken CancellationToken

Cancels the request and the polling.

Returns

Task<MailboxAuthorizationGrant>

The grant to provision.

Remarks

Polling honors the interval the authorization server stated and the slow_down answer RFC 8628 defines, because a client that polls faster than it was told is throttled or blocked outright.

Exceptions

ArgumentNullException

Thrown when an argument is null.

InvalidOperationException

Thrown when the request names no device authorization endpoint.

MailboxAuthorizationFailedException

Thrown when the authorization server refused, or the code expired unredeemed.