Compartilhar via


ClientApplicationBase.AcquireTokenSilentAsync Method

Definition

Overloads

AcquireTokenSilentAsync(IEnumerable<String>, IAccount)
Obsolete.

[V2 API] Attempts to acquire an access token for the account from the user token cache.

AcquireTokenSilentAsync(IEnumerable<String>, IAccount, String, Boolean)
Obsolete.

[V2 API] Attempts to acquire an access token for the account from the user token cache, with advanced parameters controlling network call.

AcquireTokenSilentAsync(IEnumerable<String>, IAccount)

Caution

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

[V2 API] Attempts to acquire an access token for the account from the user token cache.

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

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account for which the token is requested. IAccount

Returns

An AuthenticationResult containing the requested token

Implements

Attributes

Exceptions

can be thrown in the case where an interaction is required with the end user of the application, for instance so that the user consents, or re-signs-in (for instance if the password expired), or performs two factor authentication

Remarks

The access token is considered a match if it contains at least all the requested scopes. This means that an access token with more scopes than requested could be returned as well. If the access token is expired or close to expiration (within a 5 minute window), then the cached refresh token (if available) is used to acquire a new access token by making a silent network call.

See https://aka.ms/msal-net-acquiretokensilent for more details

Applies to

AcquireTokenSilentAsync(IEnumerable<String>, IAccount, String, Boolean)

Caution

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

[V2 API] Attempts to acquire an access token for the account from the user token cache, with advanced parameters controlling network call.

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

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account for which the token is requested. IAccount

authority
String

Specific authority for which the token is requested. Passing a different value than configured in the application constructor narrows down the selection to a specific tenant. This does not change the configured value in the application. This is specific to applications managing several accounts (like a mail client with several mailboxes)

forceRefresh
Boolean

If true, ignore any access token in the cache and attempt to acquire new access token using the refresh token for the account if this one is available. This can be useful in the case when the application developer wants to make sure that conditional access policies are applied immediately, rather than after the expiration of the access token

Returns

An AuthenticationResult containing the requested access token

Implements

Attributes

Exceptions

can be thrown in the case where an interaction is required with the end user of the application, for instance, if no refresh token was in the cache,a or the user needs to consent, or re-sign-in (for instance if the password expired), or performs two factor authentication

Remarks

The access token is considered a match if it contains at least all the requested scopes. This means that an access token with more scopes than requested could be returned as well. If the access token is expired or close to expiration (within a 5 minute window), then the cached refresh token (if available) is used to acquire a new access token by making a silent network call.

See https://aka.ms/msal-net-acquiretokensilent for more details

Applies to