Freigeben über


MicrosoftIdentityAuthenticationException Constructors

Definition

Overloads

Name Description
MicrosoftIdentityAuthenticationException(String)

Initializes a new instance of the MicrosoftIdentityAuthenticationException class with a specified error message.

MicrosoftIdentityAuthenticationException(String, Exception)

Initializes a new instance of the MicrosoftIdentityAuthenticationException class with a specified error message and a reference to the inner exception that is the cause of this exception.

MicrosoftIdentityAuthenticationException(String)

Initializes a new instance of the MicrosoftIdentityAuthenticationException class with a specified error message.

public MicrosoftIdentityAuthenticationException(string message);
new Microsoft.Identity.Web.MicrosoftIdentityAuthenticationException : string -> Microsoft.Identity.Web.MicrosoftIdentityAuthenticationException
Public Sub New (message As String)

Parameters

message
String

The error message that explains the reason for the exception.

Examples

throw new MicrosoftIdentityAuthenticationException(
    "Authentication options must be configured either in default options or per-request using WithAuthenticationOptions().");

Applies to

MicrosoftIdentityAuthenticationException(String, Exception)

Initializes a new instance of the MicrosoftIdentityAuthenticationException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public MicrosoftIdentityAuthenticationException(string message, Exception innerException);
new Microsoft.Identity.Web.MicrosoftIdentityAuthenticationException : string * Exception -> Microsoft.Identity.Web.MicrosoftIdentityAuthenticationException
Public Sub New (message As String, innerException As Exception)

Parameters

message
String

The error message that explains the reason for the exception.

innerException
Exception

The exception that is the cause of the current exception, or null if no inner exception is specified.

Examples

try
{
    var authHeader = await headerProvider.CreateAuthorizationHeaderAsync(scopes, options);
}
catch (Exception ex)
{
    throw new MicrosoftIdentityAuthenticationException("Failed to acquire authorization header.", ex);
}

Remarks

Use this constructor when you want to preserve the original exception that caused the authentication failure, such as exceptions from the underlying token acquisition provider.

Applies to