Table of Contents

Class AcquireTokenForManagedIdentityParameterBuilder

Namespace
Microsoft.Identity.Client
Assembly
Microsoft.Identity.Client.dll

Builder for AcquireTokenForManagedIdentity (used to get token for managed identities). See https://aka.ms/msal-net-managed-identity

public sealed class AcquireTokenForManagedIdentityParameterBuilder : AbstractManagedIdentityAcquireTokenParameterBuilder<AcquireTokenForManagedIdentityParameterBuilder>
Inheritance
AcquireTokenForManagedIdentityParameterBuilder
Inherited Members

Methods

WithClaims(string)

Adds a claims challenge to the token request. The SDK will bypass the token cache when a claims challenge is specified. Retry the token acquisition, and use this value in the WithClaims(string) method. A claims challenge typically arises when calling the protected downstream API, for example when the tenant administrator revokes credentials. Apps are required to look for a 401 Unauthorized response from the protected api and to parse the WWW-Authenticate response header in order to extract the claims. See https://aka.ms/msal-net-claim-challenge for details.

public AcquireTokenForManagedIdentityParameterBuilder WithClaims(string claims)

Parameters

claims string

A string with one or multiple claims.

Returns

AcquireTokenForManagedIdentityParameterBuilder

The builder to chain .With methods.

WithForceRefresh(bool)

Specifies if the client application should ignore access tokens when reading the token cache. New tokens will still be written to the application token cache. By default the token is taken from the application token cache (forceRefresh=false)

public AcquireTokenForManagedIdentityParameterBuilder WithForceRefresh(bool forceRefresh)

Parameters

forceRefresh bool

If true, the request will ignore cached access tokens on read, but will still write them to the cache once obtained from the Identity Provider. The default is false

Returns

AcquireTokenForManagedIdentityParameterBuilder

The builder to chain the .With methods

Remarks

Do not use this flag except in well understood cases. Identity Providers will throttle clients that issue too many similar token requests.