MsalClientException Class

  • java.lang.Object
    • BaseException
      • MsalException
        • com.microsoft.identity.client.exception.MsalClientException

public class MsalClientException extends MsalException

This exception class represents general errors that are local to the library. Below is the table of proposed codes and a short description of each.

Set of error codes that could be returned from this exception:

  • multiple_matching_tokens_detected: There are multiple cache entries found and the sdk cannot identify the correct access or refresh token from the cache. This usually indicates a bug in the sdk for storing tokens or the authority is not provided in the silent request and multiple matching tokens found.

  • device_network_not_available: No active network is available on the device.

  • json_parse_failure: The sdk failed to parse the JSON format.

  • io_error: IOException happened, could be the device/network errors.

  • malformed_url: The url is malformed. Likely caused when constructing the auth request, authority, or redirect URI.

  • unsupported_encoding: The encoding is not supported by the device.

  • no_such_algorithm: The algorithm used to generate pkce challenge is not supported.

  • invalid_jwt: JWT returned by the server is not valid, empty or malformed.

  • state_mismatch: State from authorization response did not match the state in the authorization request. For authorization requests, the sdk will verify the state returned from redirect and the one sent in the request.

  • unsupported_url: Unsupported url, cannot perform ADFS authority validation.

  • authority_validation_not_supported: The authority is not supported for authority validation. The sdk supports b2c authorities, but doesn't support b2c authority validation. Only well-known host will be supported.

  • chrome_not_installed: Chrome is not installed on the device. The sdk uses chrome custom tab for authorization requests if available, and will fall back to chrome browser.

  • user_mismatch: The user provided in the acquire token request doesn't match the user returned from server.

Field Summary

Modifier and Type Field and Description
final String APP_MANIFEST_VALIDATION_ERROR

Developer error. Application manifest is not properly configured to support MSAL.

final String AUTHORITY_VALIDATION_NOT_SUPPORTED

The authority is not supported for authority validation. The sdk supports b2c authority, but we don't support b2c authority validation yet. Only well-known host will be supported.

final String BROKER_BIND_FAILURE

Failed to bind the service in broker app.

final String BROKER_NOT_INSTALLED

Broker app is not installed.

final String CHROME_NOT_INSTALLED

Note: after MSAL 0.2.0 this error is no longer relevant. chrome_not_installed: Chrome is not installed on the device. The sdk uses chrome custom tab for authorization requests if available, and will fall back to chrome browser.

final String CURRENT_ACCOUNT_MISMATCH

The account that is being signed in does not match with the provided account.

final String CURRENT_ACCOUNT_MISMATCH_ERROR_MESSAGE
final String DEVICE_NETWORK_NOT_AVAILABLE

No active network is available on the device.

final String DUPLICATE_COMMAND

Duplicate command. The same command is already be processed.

final String DUPLICATE_QUERY_PARAMETER

Extra query parameters set by the client app is already sent by the sdk.

final String INVALID_JWT

JWT returned by the server is not valid, empty or malformed.

final String INVALID_PARAMETER

The parameter provided by the user is invalid.

final String IO_ERROR

IOException happened, could be the device/network errors.

final String JSON_PARSE_FAILURE

The sdk failed to parse the Json format.

final String MALFORMED_URL

The url is malformed. Likely caused when constructing the auth request, authority, or redirect URI.

final String MULTIPLE_MATCHING_TOKENS_DETECTED

There are multiple cache entries found, the sdk cannot pick the correct access token or refresh token from the cache. Likely it's a bug in the sdk when caching tokens or authority is not proviced in the silent request and multiple tokens were found.

final String NO_CURRENT_ACCOUNT

No account currently signed in to SingleAccountPublicClientApplication

final String NO_CURRENT_ACCOUNT_ERROR_MESSAGE
final String NO_SUCH_ALGORITHM

The algorithm used to generate pkce challenge is not supported.

final String NOT_ELIGIBLE_TO_USE_BROKER

Not eligible to use Broker.

final String REDIRECT_URI_VALIDATION_ERROR

Developer error. The redirect URI in the configuration file doesn't match with the one generated with package name and signature hash.

final String SAPCA_USE_WITH_MULTI_POLICY_B2C

Configuration error. SingleAccount apps cannot be used with multiple B2C policies, as each policy creates a separate Account.

final String SCOPE_EMPTY_OR_NULL

A scope is required when making a token request

final String STATE_MISMATCH

State from authorization response did not match the state in the authorization request. For authorization requests, the sdk will verify the state returned from redirect and the one sent in the request.

final String UNKNOWN_AUTHORITY

The authority is unknown. Occurs when the authority is not part of configuration or the authority host is not recognized by Microsoft.

final String UNKNOWN_ERROR

Extra query parameters set by the client app is already sent by the sdk.

final String UNSUPPORTED_ENCODING

The encoding is not supported by the device.

final String UNSUPPORTED_URL

Unsupported url, cannot perform adfs authority validation.

final String USER_MISMATCH

The user provided in the acquire token request doesn't match the user returned from server.

Constructor Summary

Constructor Description
MsalClientException(final String errorCode)
MsalClientException(final String errorCode, final String errorMessage)
MsalClientException(final String errorCode, final String errorMessage, final Throwable throwable)

Inherited Members

Field Details

APP_MANIFEST_VALIDATION_ERROR

public static final String APP_MANIFEST_VALIDATION_ERROR= "app_manifest_validation_error"

Developer error. Application manifest is not properly configured to support MSAL.

AUTHORITY_VALIDATION_NOT_SUPPORTED

public static final String AUTHORITY_VALIDATION_NOT_SUPPORTED= ClientException.AUTHORITY_VALIDATION_NOT_SUPPORTED

The authority is not supported for authority validation. The sdk supports b2c authority, but we don't support b2c authority validation yet. Only well-known host will be supported.

BROKER_BIND_FAILURE

public static final String BROKER_BIND_FAILURE= ErrorStrings.BROKER_BIND_SERVICE_FAILED

Failed to bind the service in broker app.

BROKER_NOT_INSTALLED

public static final String BROKER_NOT_INSTALLED= "broker_not_installed"

Broker app is not installed.

CHROME_NOT_INSTALLED

public static final String CHROME_NOT_INSTALLED= "chrome_not_installed"

Note: after MSAL 0.2.0 this error is no longer relevant. chrome_not_installed: Chrome is not installed on the device. The sdk uses chrome custom tab for authorization requests if available, and will fall back to chrome browser.

CURRENT_ACCOUNT_MISMATCH

public static final String CURRENT_ACCOUNT_MISMATCH= "current_account_mismatch"

The account that is being signed in does not match with the provided account.

CURRENT_ACCOUNT_MISMATCH_ERROR_MESSAGE

public static final String CURRENT_ACCOUNT_MISMATCH_ERROR_MESSAGE= "The signed in account does not match with the provided account."

DEVICE_NETWORK_NOT_AVAILABLE

public static final String DEVICE_NETWORK_NOT_AVAILABLE= ClientException.DEVICE_NETWORK_NOT_AVAILABLE

No active network is available on the device.

DUPLICATE_COMMAND

public static final String DUPLICATE_COMMAND= "duplicate_command"

Duplicate command. The same command is already be processed.

DUPLICATE_QUERY_PARAMETER

public static final String DUPLICATE_QUERY_PARAMETER= ClientException.DUPLICATE_QUERY_PARAMETER

Extra query parameters set by the client app is already sent by the sdk.

INVALID_JWT

public static final String INVALID_JWT= ClientException.INVALID_JWT

JWT returned by the server is not valid, empty or malformed.

INVALID_PARAMETER

public static final String INVALID_PARAMETER= "invalid_parameter"

The parameter provided by the user is invalid.

IO_ERROR

public static final String IO_ERROR= ClientException.IO_ERROR

IOException happened, could be the device/network errors.

JSON_PARSE_FAILURE

public static final String JSON_PARSE_FAILURE= ClientException.JSON_PARSE_FAILURE

The sdk failed to parse the Json format.

MALFORMED_URL

public static final String MALFORMED_URL= ClientException.MALFORMED_URL

The url is malformed. Likely caused when constructing the auth request, authority, or redirect URI.

MULTIPLE_MATCHING_TOKENS_DETECTED

public static final String MULTIPLE_MATCHING_TOKENS_DETECTED= ClientException.MULTIPLE_MATCHING_TOKENS_DETECTED

There are multiple cache entries found, the sdk cannot pick the correct access token or refresh token from the cache. Likely it's a bug in the sdk when caching tokens or authority is not proviced in the silent request and multiple tokens were found.

NO_CURRENT_ACCOUNT

public static final String NO_CURRENT_ACCOUNT= "no_current_account"

No account currently signed in to SingleAccountPublicClientApplication

NO_CURRENT_ACCOUNT_ERROR_MESSAGE

public static final String NO_CURRENT_ACCOUNT_ERROR_MESSAGE= "There is no signed in account."

NO_SUCH_ALGORITHM

public static final String NO_SUCH_ALGORITHM= ClientException.NO_SUCH_ALGORITHM

The algorithm used to generate pkce challenge is not supported.

NOT_ELIGIBLE_TO_USE_BROKER

public static final String NOT_ELIGIBLE_TO_USE_BROKER= "not_eligible_to_use_broker"

Not eligible to use Broker.

REDIRECT_URI_VALIDATION_ERROR

public static final String REDIRECT_URI_VALIDATION_ERROR= "redirect_uri_validation_error"

Developer error. The redirect URI in the configuration file doesn't match with the one generated with package name and signature hash.

SAPCA_USE_WITH_MULTI_POLICY_B2C

public static final String SAPCA_USE_WITH_MULTI_POLICY_B2C= "SingleAccountPublicClientApplication cannot be used with multiple B2C policies."

Configuration error. SingleAccount apps cannot be used with multiple B2C policies, as each policy creates a separate Account.

SCOPE_EMPTY_OR_NULL

public static final String SCOPE_EMPTY_OR_NULL= ClientException.SCOPE_EMPTY_OR_NULL

A scope is required when making a token request

STATE_MISMATCH

public static final String STATE_MISMATCH= ClientException.STATE_MISMATCH

State from authorization response did not match the state in the authorization request. For authorization requests, the sdk will verify the state returned from redirect and the one sent in the request.

UNKNOWN_AUTHORITY

public static final String UNKNOWN_AUTHORITY= ClientException.UNKNOWN_AUTHORITY

The authority is unknown. Occurs when the authority is not part of configuration or the authority host is not recognized by Microsoft.

UNKNOWN_ERROR

public static final String UNKNOWN_ERROR= ClientException.UNKNOWN_ERROR

Extra query parameters set by the client app is already sent by the sdk.

UNSUPPORTED_ENCODING

public static final String UNSUPPORTED_ENCODING= ClientException.UNSUPPORTED_ENCODING

The encoding is not supported by the device.

UNSUPPORTED_URL

public static final String UNSUPPORTED_URL= ClientException.UNSUPPORTED_URL

Unsupported url, cannot perform adfs authority validation.

USER_MISMATCH

public static final String USER_MISMATCH= ClientException.USER_MISMATCH

The user provided in the acquire token request doesn't match the user returned from server.

Constructor Details

MsalClientException

public MsalClientException(final String errorCode)

Parameters:

errorCode

MsalClientException

public MsalClientException(final String errorCode, final String errorMessage)

Parameters:

errorCode
errorMessage

MsalClientException

public MsalClientException(final String errorCode, final String errorMessage, final Throwable throwable)

Parameters:

errorCode
errorMessage
throwable

Applies to