PublicClientApplication.AcquireTokenWithDeviceCode Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
public Microsoft.Identity.Client.AcquireTokenWithDeviceCodeParameterBuilder AcquireTokenWithDeviceCode (System.Collections.Generic.IEnumerable<string> scopes, Func<Microsoft.Identity.Client.DeviceCodeResult,System.Threading.Tasks.Task> deviceCodeResultCallback);
abstract member AcquireTokenWithDeviceCode : seq<string> * Func<Microsoft.Identity.Client.DeviceCodeResult, System.Threading.Tasks.Task> -> Microsoft.Identity.Client.AcquireTokenWithDeviceCodeParameterBuilder
override this.AcquireTokenWithDeviceCode : seq<string> * Func<Microsoft.Identity.Client.DeviceCodeResult, System.Threading.Tasks.Task> -> Microsoft.Identity.Client.AcquireTokenWithDeviceCodeParameterBuilder
Public Function AcquireTokenWithDeviceCode (scopes As IEnumerable(Of String), deviceCodeResultCallback As Func(Of DeviceCodeResult, Task)) As AcquireTokenWithDeviceCodeParameterBuilder
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
A builder enabling you to add optional parameters before executing the token request
Implements
Remarks
You can also pass optional parameters by calling: WithExtraQueryParameters(Dictionary<String,String>) to pass additional query parameters to the STS, and one of the overrides of WithAuthority(String, Boolean) in order to override the default authority set at the application construction. Note that the overriding authority needs to be part of the known authorities added to the application construction.
Applies to
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기