Language

MsalClientException Class

Definition

This exception class represents errors that are local to the library or the device. Contrary to MsalServiceException which represent errors happening from the Azure AD service or the network. For more details, see https://aka.ms/msal-net-exceptions

public class MsalClientException : Microsoft.Identity.Client.MsalException
type MsalClientException = class
    inherit MsalException
Public Class MsalClientException
Inherits MsalException
Inheritance
MsalClientException

Constructors

Name Description
MsalClientException(String, String, Exception)

Initializes a new instance of the exception class with a specified error code, error message and inner exception.

MsalClientException(String, String)

Initializes a new instance of the exception class with a specified error code and error message.

MsalClientException(String)

Initializes a new instance of the exception class with a specified error code.

Fields

Name Description
AuthenticationResultMetadataKey

A key on Data under which MSAL stores the AuthenticationResultMetadata captured when a token acquisition fails with a non-MsalException. Lets downstream consumers surface token-acquisition diagnostics even though the originating exception is re-thrown unchanged.

(Inherited from MsalException)
BrokerErrorCode

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerErrorContext

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerErrorStatus

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerErrorTag

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerTelemetry

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
ManagedIdentitySource

An AdditionalExceptionData property key, available when using managed identity.

(Inherited from MsalException)

Properties

Name Description
AdditionalExceptionData

A property bag with extra details for this exception.

(Inherited from MsalException)
AuthenticationResultMetadata

Diagnostic metadata for the failed token-acquisition attempt β€” the total duration and, when the relevant stage ran, HTTP/cache durations, token endpoint, and region used. This is null when the exception was thrown before the request pipeline started collecting metadata (for example, parameter or builder validation). When it is non-null β€” the typical in-request failure β€” DurationTotalInMs is always populated (useful for latency measurement), while the other fields may be 0/null when the corresponding stage did not run. On a failure TokenSource has no meaningful value and should not be relied on. Reuses the type returned by AuthenticationResultMetadata on the success path.

(Inherited from MsalException)
CorrelationId

An ID that can used to piece up a single authentication flow.

(Inherited from MsalException)
ErrorCode

Gets the protocol error code returned by the service or generated by the client. This is the code you can rely on for exception handling. Values for this code are typically provided in constant strings in the derived exceptions types with explanations of mitigation.

(Inherited from MsalException)
IsRetryable

Indicates if the previous operation that resulted in this exception should be retried.

(Inherited from MsalException)

Methods

Name Description
ToJsonString()

Allows serialization of most values of the exception into JSON.

(Inherited from MsalException)
ToString()

Creates and returns a string representation of the current exception.

(Inherited from MsalException)

Applies to