次の方法で共有


IPublicClientApplication.AcquireTokenWithDeviceCodeAsync Method

Definition

Overloads

AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, Func<DeviceCodeResult,Task>)
Obsolete.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information
See https://aka.ms/msal-device-code-flow.
AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, Func<DeviceCodeResult,Task>, CancellationToken)
Obsolete.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device, with possibility of cancelling the token acquisition before it times out. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information. This step is cancelable
See https://aka.ms/msal-device-code-flow.
AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, String, Func<DeviceCodeResult,Task>)
Obsolete.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device, with possibility of passing extra parameters. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information
See https://aka.ms/msal-device-code-flow.
AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, String, Func<DeviceCodeResult,Task>, CancellationToken)
Obsolete.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device, with possibility of passing extra query parameters and cancelling the token acquisition before it times out. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information. This step is cancelable
See https://aka.ms/msal-device-code-flow.

AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, Func<DeviceCodeResult,Task>)

Caution

Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information
See https://aka.ms/msal-device-code-flow.
[System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenWithDeviceCodeAsync (System.Collections.Generic.IEnumerable<string> scopes, Func<Microsoft.Identity.Client.DeviceCodeResult,System.Threading.Tasks.Task> deviceCodeResultCallback);
[<System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
abstract member AcquireTokenWithDeviceCodeAsync : seq<string> * Func<Microsoft.Identity.Client.DeviceCodeResult, System.Threading.Tasks.Task> -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenWithDeviceCodeAsync (scopes As IEnumerable(Of String), deviceCodeResultCallback As Func(Of DeviceCodeResult, Task)) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

deviceCodeResultCallback
Func<DeviceCodeResult,Task>

Callback containing information to show the user about how to authenticate and enter the device code.

Returns

Authentication result containing a token for the requested scopes and for the user who has authenticated on another device with the code

Attributes

Applies to

AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, Func<DeviceCodeResult,Task>, CancellationToken)

Caution

Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device, with possibility of cancelling the token acquisition before it times out. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information. This step is cancelable
See https://aka.ms/msal-device-code-flow.
[System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenWithDeviceCodeAsync (System.Collections.Generic.IEnumerable<string> scopes, Func<Microsoft.Identity.Client.DeviceCodeResult,System.Threading.Tasks.Task> deviceCodeResultCallback, System.Threading.CancellationToken cancellationToken);
[<System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
abstract member AcquireTokenWithDeviceCodeAsync : seq<string> * Func<Microsoft.Identity.Client.DeviceCodeResult, System.Threading.Tasks.Task> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenWithDeviceCodeAsync (scopes As IEnumerable(Of String), deviceCodeResultCallback As Func(Of DeviceCodeResult, Task), cancellationToken As CancellationToken) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

deviceCodeResultCallback
Func<DeviceCodeResult,Task>

The callback containing information to show the user about how to authenticate and enter the device code.

cancellationToken
CancellationToken

A CancellationToken which can be triggered to cancel the operation in progress.

Returns

Authentication result containing a token for the requested scopes and for the user who has authenticated on another device with the code

Attributes

Applies to

AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, String, Func<DeviceCodeResult,Task>)

Caution

Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device, with possibility of passing extra parameters. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information
See https://aka.ms/msal-device-code-flow.
[System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenWithDeviceCodeAsync (System.Collections.Generic.IEnumerable<string> scopes, string extraQueryParameters, Func<Microsoft.Identity.Client.DeviceCodeResult,System.Threading.Tasks.Task> deviceCodeResultCallback);
[<System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
abstract member AcquireTokenWithDeviceCodeAsync : seq<string> * string * Func<Microsoft.Identity.Client.DeviceCodeResult, System.Threading.Tasks.Task> -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenWithDeviceCodeAsync (scopes As IEnumerable(Of String), extraQueryParameters As String, deviceCodeResultCallback As Func(Of DeviceCodeResult, Task)) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

deviceCodeResultCallback
Func<DeviceCodeResult,Task>

Callback containing information to show the user about how to authenticate and enter the device code.

Returns

Authentication result containing a token for the requested scopes and for the user who has authenticated on another device with the code

Attributes

Applies to

AcquireTokenWithDeviceCodeAsync(IEnumerable<String>, String, Func<DeviceCodeResult,Task>, CancellationToken)

Caution

Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes.

Acquires a security token on a device without a web browser, by letting the user authenticate on another device, with possibility of passing extra query parameters and cancelling the token acquisition before it times out. This is done in two steps:

  • the method first acquires a device code from the authority and returns it to the caller via the deviceCodeResultCallback. This callback takes care of interacting with the user to direct them to authenticate (to a specific URL, with a code)
  • The method then proceeds to poll for the security token which is granted upon successful login by the user based on the device code information. This step is cancelable
See https://aka.ms/msal-device-code-flow.
[System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenWithDeviceCodeAsync (System.Collections.Generic.IEnumerable<string> scopes, string extraQueryParameters, Func<Microsoft.Identity.Client.DeviceCodeResult,System.Threading.Tasks.Task> deviceCodeResultCallback, System.Threading.CancellationToken cancellationToken);
[<System.Obsolete("Use AcquireTokenWithDeviceCode instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
abstract member AcquireTokenWithDeviceCodeAsync : seq<string> * string * Func<Microsoft.Identity.Client.DeviceCodeResult, System.Threading.Tasks.Task> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenWithDeviceCodeAsync (scopes As IEnumerable(Of String), extraQueryParameters As String, deviceCodeResultCallback As Func(Of DeviceCodeResult, Task), cancellationToken As CancellationToken) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

extraQueryParameters
String

This parameter will be appended as is to the query string in the HTTP authentication request to the authority. This is expected to be a string of segments of the form key=value separated by an ampersand character. The parameter can be null.

deviceCodeResultCallback
Func<DeviceCodeResult,Task>

The callback containing information to show the user about how to authenticate and enter the device code.

cancellationToken
CancellationToken

A CancellationToken which can be triggered to cancel the operation in progress.

Returns

Authentication result containing a token for the requested scopes and for the user who has authenticated on another device with the code

Attributes

Applies to