Compartilhar via


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 Acquire tokens silently.

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 Acquire tokens silently.

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 Acquire tokens silently.

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

When an interaction is required with the end user of the application, for instance, if no refresh token was in the cache; the user needs to consent or to 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.

Applies to

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 Acquire tokens silently.

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

When an interaction is required with the end user of the application, for instance, if no refresh token was in the cache; the user needs to consent or to 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.

Applies to