IClientApplicationBase.AcquireTokenSilent Method

Definition

Overloads

AcquireTokenSilent(IEnumerable<String>, IAccount)

Attempts to acquire an access token for the account from the user token cache, with advanced parameters controlling the network call. See https://aka.ms/msal-net-acquiretokensilent for more details

AcquireTokenSilent(IEnumerable<String>, String)

Attempts to acquire an access token for the loginHint from the user token cache, with advanced parameters controlling the network call. See https://aka.ms/msal-net-acquiretokensilent for more details

AcquireTokenSilent(IEnumerable<String>, IAccount)

Attempts to acquire an access token for the account from the user token cache, with advanced parameters controlling the network call. See https://aka.ms/msal-net-acquiretokensilent for more details

public Microsoft.Identity.Client.AcquireTokenSilentParameterBuilder AcquireTokenSilent (System.Collections.Generic.IEnumerable<string> scopes, Microsoft.Identity.Client.IAccount account);
abstract member AcquireTokenSilent : seq<string> * Microsoft.Identity.Client.IAccount -> Microsoft.Identity.Client.AcquireTokenSilentParameterBuilder
Public Function AcquireTokenSilent (scopes As IEnumerable(Of String), account As IAccount) As AcquireTokenSilentParameterBuilder

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

account
IAccount

Account for which the token is requested. IAccount

Returns

An AcquireTokenSilentParameterBuilder used to build the token request, adding optional parameters

Exceptions

will 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 the user needs to perform 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 also the additional parameters that you can set chain: WithAuthority(String, Boolean) or one of its overrides to request a token for a different authority than the one set at the application construction WithForceRefresh(Boolean) to bypass the user token cache and force refreshing the token, as well as WithExtraQueryParameters(Dictionary<String,String>) to specify extra query parameters

AcquireTokenSilent(IEnumerable<String>, String)

Attempts to acquire an access token for the loginHint from the user token cache, with advanced parameters controlling the network call. See https://aka.ms/msal-net-acquiretokensilent for more details

public Microsoft.Identity.Client.AcquireTokenSilentParameterBuilder AcquireTokenSilent (System.Collections.Generic.IEnumerable<string> scopes, string loginHint);
abstract member AcquireTokenSilent : seq<string> * string -> Microsoft.Identity.Client.AcquireTokenSilentParameterBuilder
Public Function AcquireTokenSilent (scopes As IEnumerable(Of String), loginHint As String) As AcquireTokenSilentParameterBuilder

Parameters

scopes
IEnumerable<String>

Scopes requested to access a protected API

loginHint
String

Typically the username, in UPN format, e.g. johnd@contoso.com

Returns

An AcquireTokenSilentParameterBuilder used to build the token request, adding optional parameters

Exceptions

will 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 the user needs to perform 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 also the additional parameters that you can set chain: WithAuthority(String, Boolean) or one of its overrides to request a token for a different authority than the one set at the application construction WithForceRefresh(Boolean) to bypass the user token cache and force refreshing the token, as well as WithExtraQueryParameters(Dictionary<String,String>) to specify extra query parameters

Applies to