Method ApproveAsync
ApproveAsync(string, string, string?, CancellationToken)
Approves the device waiting with a code typed by a signed-in user, so that the device is signed in to that user's account, and returns the outcome with the details of the device that was approved. A link can only be approved once.
Declaration
public Task<DeviceLinkApprovalResult> ApproveAsync(string code, string approverUserId, string? appData = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | code | The code as typed by the user (see Normalize(string)). |
| string | approverUserId | The ID of the signed-in user who typed the code and whom the new device will be signed in as. |
| string | appData | An optional value of the app's that the sign-in code issued for the link carries (see AppData). It is kept in the short-lived store with the approval. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<DeviceLinkApprovalResult> |
Exceptions
| Type | Condition |
|---|---|
| TooManyRequestsApiException | The user entered too many wrong codes (DeviceLinkTooManyWrongCodes). |
ApproveAsync(string, ISessionToken, string?, CancellationToken)
Approves the device waiting with a code typed by a signed-in user, so that the device is signed in to that user's account, and returns the outcome with the details of the device that was approved. A link can only be approved once.
Declaration
public Task<DeviceLinkApprovalResult> ApproveAsync(string code, ISessionToken approver, string? appData = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | code | The code as typed by the user (see Normalize(string)). |
| ISessionToken | approver | The session token of the signed-in user who typed the code and whom the new device will be signed in as, whose UserId identifies them. |
| string | appData | An optional value of the app's that the sign-in code issued for the link carries (see AppData). It is kept in the short-lived store with the approval. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<DeviceLinkApprovalResult> |
Exceptions
| Type | Condition |
|---|---|
| TooManyRequestsApiException | The user entered too many wrong codes (DeviceLinkTooManyWrongCodes). |