Udostępnij za pośrednictwem


ConfidentialClientApplication.AcquireTokenForClientAsync Method

Definition

Overloads

AcquireTokenForClientAsync(IEnumerable<String>)
Obsolete.

[V3 API] Acquires a token from the authority configured in the app, for the confidential client itself (in the name of no user) using the client credentials flow. (See https://aka.ms/msal-net-client-credentials)

AcquireTokenForClientAsync(IEnumerable<String>, Boolean)
Obsolete.

[V2 API] Acquires a token from the authority configured in the app, for the confidential client itself (in the name of no user) using the client credentials flow. (See https://aka.ms/msal-net-client-credentials)

AcquireTokenForClientAsync(IEnumerable<String>)

Caution

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

[V3 API] Acquires a token from the authority configured in the app, for the confidential client itself (in the name of no user) using the client credentials flow. (See https://aka.ms/msal-net-client-credentials)

[System.Obsolete("Use AcquireTokenForClient instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenForClientAsync (System.Collections.Generic.IEnumerable<string> scopes);
[<System.Obsolete("Use AcquireTokenForClient instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
abstract member AcquireTokenForClientAsync : seq<string> -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
override this.AcquireTokenForClientAsync : seq<string> -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenForClientAsync (scopes As IEnumerable(Of String)) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

scopes requested to access a protected API. For this flow (client credentials), the scopes should be of the form "{ResourceIdUri/.default}" for instance https://management.azure.net/.default or, for Microsoft Graph, https://graph.microsoft.com/.default as the requested scopes are really defined statically at application registration in the portal, and cannot be overridden in the application. See also

Returns

Authentication result containing the token of the user for the requested scopes

Implements

Attributes

Applies to

AcquireTokenForClientAsync(IEnumerable<String>, Boolean)

Caution

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

[V2 API] Acquires a token from the authority configured in the app, for the confidential client itself (in the name of no user) using the client credentials flow. (See https://aka.ms/msal-net-client-credentials)

[System.Obsolete("Use AcquireTokenForClient instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)]
public System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult> AcquireTokenForClientAsync (System.Collections.Generic.IEnumerable<string> scopes, bool forceRefresh);
[<System.Obsolete("Use AcquireTokenForClient instead. See https://aka.ms/msal-net-3-breaking-changes. ", true)>]
abstract member AcquireTokenForClientAsync : seq<string> * bool -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
override this.AcquireTokenForClientAsync : seq<string> * bool -> System.Threading.Tasks.Task<Microsoft.Identity.Client.AuthenticationResult>
Public Function AcquireTokenForClientAsync (scopes As IEnumerable(Of String), forceRefresh As Boolean) As Task(Of AuthenticationResult)

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API. For this flow (client credentials), the scopes should be of the form "{ResourceIdUri/.default}" for instance https://management.azure.net/.default or, for Microsoft Graph, https://graph.microsoft.com/.default as the requested scopes are really defined statically at application registration in the portal, and cannot be overridden in the application

forceRefresh
Boolean

If true, API will ignore the access token in the cache and attempt to acquire new access token using client credentials. This override can be used in case the application knows that conditional access policies changed

Returns

Authentication result containing token of the user for the requested scopes

Implements

Attributes

See also

Applies to