Share via


IClientApplicationBase.AcquireTokenSilentAsync Method

Definition

Overloads

AcquireTokenSilentAsync(IEnumerable<String>, IAccount)
Obsolete.

Attempts to acquire an access token for the account from the user token cache.

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

Attempts to acquire and access token for the account from the user token cache, with advanced parameters making a network call.

AcquireTokenSilentAsync(IEnumerable<String>, IAccount)

Caution

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

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>
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

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 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-acuiretokensilent for more details

Applies to

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

Caution

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

Attempts to acquire and access token for the account from the user token cache, with advanced parameters making a 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>
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 of tenants for which to get a tenant, but does not change the configured value

forceRefresh
Boolean

If true, the will ignore the 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 applies immediately, rather than after the expiration of the access token

Returns

An AuthenticationResult containing the requested token

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, or the user needs to consents, 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 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