Method WaitForApprovalAsync
WaitForApprovalAsync(Func<CheckDeviceLinkCommand, CancellationToken, Task<DeviceLinkStatus>>, Action<bool>?, CancellationToken)
Checks the link's status after each poll interval until the link is approved, and returns the sign-in code that the status then has, which the new device redeems with the code verifier that the link was started with.
Declaration
public Task<string> WaitForApprovalAsync(Func<CheckDeviceLinkCommand, CancellationToken, Task<DeviceLinkStatus>> checkStatus, Action<bool>? reachabilityChanged = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<CheckDeviceLinkCommand, CancellationToken, Task<DeviceLinkStatus>> | checkStatus | Checks the link's status with the service, such as with the app's endpoint that calls |
| Action<bool> | reachabilityChanged | An optional callback that is called with false when a check fails for a reason that may not last, and with true when a check succeeds again after that. |
| CancellationToken | cancellationToken | A token to cancel the wait. |
Returns
| Type | Description |
|---|---|
| Task<string> |
Remarks
A check that fails for a reason that may not last is made again, unless the link's lifetime has passed, in which case its exception is thrown. Other exceptions of a check are thrown as they are.
Exceptions
| Type | Condition |
|---|---|
| UnauthorizedApiException | The link is unknown or has expired, with the DeviceLinkExpired error code. |
| OperationCanceledException |
|