Microsoft.Identity.Client.MsalError
What happens?
You tried to use AcquireTokenByUsernamePassword and the account is a federated account.Mitigation
None. The WS metadata was not found or does not correspond to what was expected.
What happens?
The response from the token endpoint does not contain the token_type parameter.Mitigation
This happens if the identity provider (AAD, B2C, ADFS, etc.) did not include the access token type in the token response. Verify the configuration of the identity provider.
What happens?
Broker is configured with an ADFS authority, however, it does not support ADFS environments.Mitigation
Broker does not support ADFS environments.
What happens?
The user had canceled the authentication, for instance by closing the authentication dialogMitigation
None, you cannot get a token to call the protected API. You might want to inform the user
What happens?
The authentication failed. For instance the user did not enter the right passwordMitigation
Inform the user to retry.
Mitigation
Inform the user.
What happens?
The library failed to invoke the Web View required to perform interactive authentication. The exception might include the reasonMitigation
If the exception includes the reason, you could inform the user. This might be, for instance, a browser implementing chrome tabs is missing on the Android phone (that's only an example: this exception can apply to other platforms as well)
What happens?
You did not define an authority at the application level, so it defaults to the public cloud (login.microsoft.com), but the authority at the request level is for a different cloud. Only the tenant can be changed at the request level.Mitigation
Add .WithAuthority("https://login.windows-ppe.net/common) at the application level and specify the tenant at the request level: .WithAuthority("https://login.windows-ppe.net/1234-567-890-12345678).
What happens?
You specified a tenant twice - once in WithAuthority() and once using WithTenant()Mitigation
Specify the tenant once.
What happens?
The authority configured at the application level is different than the authority configured at the request levelMitigation
Ensure the same authority type is used
What happens?
The validation of the authority failed. This might be because the authority is not compliant with the OIDC standard, or there might be a security issueMitigation
Use a different authority. If you are absolutely sure that you can trust the authority you can use the WithAuthority passing the validateAuthority parameter to false (not recommended)
What happens?
A broker application is required, but one could not be found or communicated with.Mitigation
Install a broker application, such as Authenticator, from the application store
What happens?
The request has broker enabled and Proof-of-Possession configured but the broker does not support Proof-of-PossessionMitigation
only configure Proof-of-Possession for public clients on windows.
What happens?
The request has Proof-of-Possession configured but does not have broker enabled. Broker is required to use Proof-of-Possession on public clientsMitigation
Enable the broker when Proof-of-Possession is configured.
What happens?
You tried to use AcquireTokenByIntegratedWindowsAuth but the user is not a domain user (the machine is not domain or AAD joined)
What happens?
The certificate provided is not of type RSA.Mitigation
Please use an RSA certificate.
What happens?
The certificate provided does not have a private key.Mitigation
Ensure the certificate has a private key.
What happens?
You configured MSAL confidential client authentication without an authentication type (Certificate, Secret, Client Assertion)Mitigation
Either call ConfidentialClientApplicationBuilder.WithClientSecret, ConfidentialClientApplicationBuilder.WithCertificate, ConfidentialClientApplicationBuilder.WithClientAssertion
What happens?
You configured MSAL confidential client authentication with more than one authentication type (Certificate, Secret, Client Assertion)
What happens?
In the context of Device code flow (See https://aka.ms/msal-net-device-code-flow), this error happens when the device code expired before the user signed-in on another device (this is usually after 15 mins).Mitigation
None. Inform the user that they took too long to sign-in at the provided URL and enter the provided code.
Mitigation
On Windows, use the broker via .WithBroker(true), use a different account, or otherwise call AcquireTokenInteractive
What happens?
You have configured your own instance metadata using both an Uri and a string. Only one is supported.Mitigation
Call WithInstanceDiscoveryMetadata only once. See https://aka.ms/msal-net-custom-instance-metadata for more details.
What happens?
You have used extraQueryParameter of overrides of token acquisition operations in public client and confidential client application and are passing a parameter which is already present in the URL (either because you had it in another way, or the library added it).Mitigation [App Development]
RemoveAccount the duplicate parameter from the token acquisition override.
What happens
In a confidential client application call, the client assertion built by MSAL is longer than the max possible length for a JWT token.
What happens?
You are trying to use a feature which was marked as experimentalMitigation
When creating the PublicClientApplication or ConfidentialClientApplication, use .WithExperimentalFeatures() option. See https://aka.ms/msal-net-experimental-features for details.
What happens
you called AcquireTokenSilent or AcquireTokenSilent and your mobile (Xamarin) application leverages the broker (Microsoft Authenticator or Microsoft Company Portal), but the broker was not able to acquire the token silently.Mitigation
Call AcquireTokenInteractive
What happens?
You are trying to authenticate with the broker but MSAL is unable to read the response from the broker.Mitigation
The currently installed broker may not support MSAL.Xamarin, you need to ensure that you have installed either Intune Company Portal (5.0.4689.0 or greater) or Microsoft Authenticator (6.2001.0140 or greater). see https://aka.ms/Brokered-Authentication-for-Android"
What happens?
The token could not be refreshed. This can be because the user has not used the application for a long time. and therefore the refresh token maintained in the token cache has expiredMitigation
If you are in a public client application, that supports interactivity, send an interactive request AcquireTokenInteractive. Otherwise, use a different method to acquire tokens.
Mitigation
None. The federated service returned an error. You can try to look at the Body of the exception for a better understanding of the error and choose the mitigation
What happened?
The operation attempted to force a token refresh while also using a token hash. These two options are incompatible because forcing a refresh bypasses token caching, which conflicts with token hash validation.Mitigation:
- Ensure that `force_refresh` is not set to `true` when using a token hash. - Review the request parameters to ensure they are not conflicting. - If token hashing is required, allow the cached token to be used instead of forcing a refresh.
What happens?
Failure setting process security to enable WAM Account Picker in an elevated process.Mitigation
For troubleshooting details, see https://aka.ms/msal-net-wam .
Mitigation:
If your application is a IPublicClientApplication call AcquireTokenInteractive perform an interactive authentication. If your application is a ConfidentialClientApplication chances are that the Claims member of the exception is not empty. See Claims for the right mitigation
What happened?
A cache-dependent API was called, but MSAL's internal token cache is disabled via DisableInternalCacheOptions. This can occur with APIs such as AcquireTokenSilent and AcquireTokenInLongRunningProcess(...).Mitigation
Use an authentication flow that does not depend on MSAL's internal cache, such as AcquireTokenByRefreshToken with the refresh token obtained from GetRefreshToken, or use another interactive flow, as appropriate for your application.
What happens?
The ADAL cache is invalid as it contains multiple refresh token entries for one user.Mitigation
Delete the ADAL cache. If you do not maintain an ADAL cache, this may be a bug in MSAL.
What happens
When the library attempts to discover the authority and get the endpoints it needs to acquire a token, it got an un-authorize HTTP code or an unexpected responseremediation
Check that the authority configured for the application, or passed on some overrides of token acquisition tokens supporting authority override is correct
Mitigation
Use a different authority
Mitigation
See error message for details, then take corrective action in the app registration portal See https://aka.ms/msal-net-invalid-client for details.
Mitigation
Ensure the delegate returns a non‑empty, base‑64‑encoded JWT.
What happens?
You configured both a static certificate (WithCertificate(X509Certificate2)) and a dynamic certificate provider (WithCertificate(Func)).Mitigation
Choose one approach for providing the client certificate.
What happened?
The configured credential type is not compatible with the requested authentication mode. For example, a client secret cannot be used with mTLS Proof-of-Possession or SendCertificateOverMtls because mTLS requires a certificate to bind the token to the TLS transport.Mitigation:
Use a certificate-based credential via WithCertificate(), or a delegate that returns a ClientSignedAssertion with a TokenBindingCertificate when mTLS Proof-of-Possession is required.
Mitigation:
If your application is a IPublicClientApplication call AcquireTokenInteractive perform an interactive authentication. If your application is a ConfidentialClientApplication chances are that the Claims member of the exception is not empty. See Claims for the right mitigation
What happens?
You have configured a claims request, but the claims string is not in JSON formatMitigation
Ensure that the claims parameter is valid JSON. Inspect the inner exception for details about JSON parsing.
What happens?
The library expected a JWT (for instance a token from the cache, or received from the STS), but the format is invalidMitigation
Make sure that the token cache was not tampered
What happens?
You used "AcquireTokenInteractiveParameterBuilder.WithParentActivityOrWindow(object) but the parameter you passed is invalid.Remediation
On .NET Standard, the expected object is an Activity on Android, a UIViewController on iOS, a NSWindow on MAC, and a IWin32Window or IntPr on Windows. If you are in a WPF application, you can use WindowInteropHelper(wpfControl).Handle to get the window handle associated with a WPF control
What happens?
This can happen because you are using a token acquisition method which is not compatible with the authority. For instance: you called AcquireTokenByUsernamePassword but you used an authority ending with '/common' or '/consumers' as this requires a tenanted authority or '/organizations'.Mitigation
Adjust the authority to the AcquireTokenXX method you use (don't use 'common' or 'consumers' with AcquireTokenByUsernamePassword AcquireTokenByIntegratedWindowsAuth
What happens?
You have configured your own instance metadata, but the json provided seems to be invalid.Mitigation
See https://aka.ms/msal-net-custom-instance-metadata for an example of a valid json that can be used.
What happens?
A JSON blob read from the token cache or received from the STS was not parseable. This can happen when reading the token cache, or receiving an IDToken from the STS.Mitigation
Make sure that the token cache was not tampered
What happens?
MSAL tried to open the browser on Linux using the xdg-open, gnome-open, or kfmclient tools, but failed.Mitigation
Make sure you can open a page using xdg-open tool. See https://aka.ms/msal-net-os-browser for details.
What happens?
The current redirect URL is not a loopback URL.Mitigation
To use the OS browser, a loopback URL, with or without a port, must be configured both during app registration and when initializing the IPublicClientApplication object. See https://aka.ms/msal-net-os-browser for details.
What happens?
MSAL has intercepted a Uri possibly containing an authorization code, but it does not match the configured redirect URL.Mitigation
If you are using an ICustomWebUi implementation, make sure the redirect URL matches the URL containing the auth code. If you are not using an ICustomWebUI, this could be a man-in-the middle attack.
What happens?
When the libraries go to the authority and get its open id connect configuration it expects to find a Passive Auth Endpoint entry, and could not find it.remediation
Check that the authority configured for the application, or passed on some overrides of token acquisition tokens supporting authority override is correct
Mitigation
Ensure that a tenanted authority, which includes a specific tenant ID, is specified during the application configuration. For example, use "https://login.microsoftonline.com/{tenantId}" or a similar URL structure.
What happened?
mTLS Bearer is configured but a region was not specified.Mitigation
Ensure that the AzureRegion configuration is set when using mTLS Bearer as it requires a regional endpoint.
What happened?
mTLS Proof of Possession (mTLS PoP) is configured but a certificate was not provided.Mitigation
Ensure that a valid certificate is provided in the configuration when using mTLS PoP as it is required for secure authentication.
What happened?
mTLS is not supported for managed identity authentication.
What happened?
mTLS Proof of Possession (mTLS PoP) is not supported for the specified sovereign cloud environment.Mitigation:
Use the supported alternative endpoint for the sovereign cloud environment.
What happened?
mTLS Proof of Possession (mTLS PoP) is configured but a region was not specified.Mitigation
Ensure that the AzureRegion configuration is set when using mTLS PoP as it requires a regional endpoint.
What happens?
This exception happens in the case of applications managing several identities, when calling AcquireTokenSilent or one of its overrides and the user token cache contains multiple tokens for this client application and the specified Account, but from different authorities.Mitigation [App Development]
specify the authority to use in the acquire token operation
Mitigation [App development]
In the application you could either inform the user that there are network issues or retry later
What happens?
AcquireTokenSilent or WithLoginHint was called with a loginHint parameter which does not match any account in GetAccountsAsyncMitigation
If you are certain about the loginHint, call AcquireTokenInteractive
What happens?
You haven't set a client ID.Mitigation
Use the application ID (a GUID) from the application portal as client ID in this SDK
What happens?
The request has Proof-of-Possession configured but does not have a nonce configured. A nonce is required for Proof-of-Possession on public clientsMitigation
Provide a nonce when Proof-of-Possession is configured for public clients.
What happens?
This error happens when the authorization flow, which collects user credentials, gets redirected to an page that is not supported, for example if the redirect occurs over http. This error does not trigger for the final redirect, which can be http://localhost, but for intermediary redirects.Mitigation
This usually happens when using a federated directory which is not setup correctly.
Remediation:
call AcquireTokenInteractive so that the user of your application signs-in and accepts consent.
What happens?
You need to provide a Reply URI / Redirect URI, but have not called WithRedirectUri
Mitigation:
If your application is a IPublicClientApplication call AcquireTokenInteractive so that the user of your application signs-in and accepts consent. If it's a web app you should have previously called IConfidentialClientApplication.AcquireTokenByAuthorizationCode as described in https://aka.ms/msal-net-authorization-code. You need to make sure that you have requested the right scopes. For details See https://github.com/Azure-Samples/ms-identity-aspnetcore-webapp-tutorial This error should not happen in web APIs
What happens?
The token cache does not contain a token with an OBO cache key that matches the longRunningProcessSessionKey passed into AcquireTokenInLongRunningProcess.Mitigation
Call InitiateLongRunningProcessInWebApi with this longRunningProcessSessionKey first or call AcquireTokenInLongRunningProcess with an already used longRunningProcessSessionKey.
What happens?
If can got this error when using AcquireTokenByUsernamePassword and you (or the user) did not provide a password.
What happens?
The redirect URI / reply URI is invalidHow to fix
Pass a valid redirect URI.
What happens?
You configured WithAuthority at the request level, and also WithAzureRegion. This is not supported when the environment changes from application to request.Mitigation
Use WithTenantId at the request level instead.
What happens?
You configured both Regional Authority and Authority Validation. Authority validation is not currently supported for regional authorities.Mitigation
Set the validateAuthority flag to false to use Azure Regional authority. Do not disable authority validation if you read the authority from an untrusted source, for example from the WWWAuthenticate header of an HTTP request that resulted in a 401 response.
What happens?
WithAzureRegion is set to trueMitigation
Region discovery cannot be performed for ADFS authority.
What happens?
You have configured both Region Discovery and Custom Instance Metadata. Custom metadata supersedes region discovery.Mitigation
Configure either Region Discovery or Custom Instance Discovery Metadata.
What happened?
mTLS Proof of Possession (mTLS PoP) requires a specific Azure region to be specified.Mitigation:
Ensure that the AzureRegion configuration is set when using mTLS PoP as it requires a regional endpoint.
Mitigation
you can retry after a delay.
What happens?
No scopes have been requestedMitigation
At least one scope must be specified for this authentication flow
Mitigation
you can retry after a delay.
What happens?
You have configured MSAL to request SSH certificates from AAD, and you are trying to format an HTTP authentication header.Mitigation
SSH certificates should not used as Bearer tokens. Developers are responsible for sending the certificates to the target machines.
What happens?
The library sends to the STS a state associated to a request, and expects the reply to be consistent. This errors indicates that the reply is not associated with the request. This could indicate an attempt to replay a responseMitigation
None
What happens?
You configured MSAL cache serialization at the same time with a static internal cache via WithCacheOptions These are mutually exclusive.Mitigation
Use only one option. Web site and web API scenarios should rely on external cache serialization, as internal cache serialization cannot scale. See https://aka.ms/msal-net-cca-token-cache-serialization
What happens?
You configured MSAL interactive authentication to use an embedded WebView and you also configured SystemWebViewOptions. These are mutually exclusive.Mitigation
Either set WithUseEmbeddedWebView to true or do not use WithSystemWebViewOptions
What happens?
You have configured both a telemetry callback and a telemetry config.Mitigation
Only one telemetry mechanism can be configured.
What happens?
While reading the OpenId configuration associated with the authority, the Authorize endpoint, or Token endpoint, or the Issuer was not foundMitigation
This indicates and authority which is not Open ID Connect compliant. Specify a different authority in the constructor of the application, or the token acquisition override ///
What happens?
You configured WithTenant at the request level, but the application is using a non-AAD authority These are mutually exclusive.Mitigation
WithTenantId can only be used in conjunction with AAD authorities.
What happens?
You asked for one type of token, but did not receive it.Mitigation
This happens if the Identity Provider (AAD, B2C, ADFS etc.) does not support / implement the requested token type. In case of ADFS, consider upgrading to the latest version.
What happens
You called AcquireTokenByIntegratedWindowsAuth, but the domain user name could not be found.Mitigation
This might be because you need to add more capabilities to your UWP application in the Package.appxmanifest. See https://aka.ms/msal-net-uwp
What happens
You called AcquireTokenByIntegratedWindowsAuth, but the domain user name could not be found.Mitigation
This might be because you need to add more capabilities to your UWP application in the Package.appxmanifest. See https://aka.ms/msal-net-uwp
Mitigation
Catch the exception and use the properties in it to obtain the right parameters from Intune SDK. IntuneAppProtectionPolicyRequiredException
Mitigation
None. You might want to inform the end user.
Mitigation
None. You might want to inform the end user.
What happens
You can get this error when using AcquireTokenByUsernamePassword The user is not known by the IdPMitigation
Inform the user. The login that the user provided might be incorrect (for instance empty)
What happens
You can get this error when using AcquireTokenByUsernamePassword The user is not recognized as a managed user, or a federated user. Azure AD was not able to identify the IdP that needs to process the userMitigation
Inform the user. the login that the user provided might be incorrect.
What happens?
An override of a token acquisition operation was called in IPublicClientApplication which takes a loginHint as a parameters, but this login hint was not using the UserPrincipalName (UPN) format, e.g. john.doe@contoso.com expected by the serviceRemediation
Make sure in your code that you enforce loginHint to be a UPN
Mitigation
Pass a valid value for user assertion
Mitigation
Pass a different account, or otherwise call AcquireTokenInteractive
What happens?
You have configured your own instance metadata, and have also set validate authority to true. These are mutually exclusive.Mitigation
Set the validate authority flag to false. See https://aka.ms/msal-net-custom-instance-metadata for more details.
What happens?
Windows Authentication Broker, which handles the interaction between the user and AAD, has failed.Mitigation
See the error message for more details.
What happens?
No scopes have been requestedMitigation
At least one scope must be specified for MSAL Runtime WAM
What happens?
The embedded WebView2 browser cannot be started because a runtime component cannot be loaded.Mitigation
For troubleshooting details, see https://aka.ms/msal-net-webview2 .
What happens?
The embedded browser cannot be started because a runtime component is missing.Mitigation
The embedded browser needs WebView2 runtime to be installed. An end user of the app can download and install the WebView2 runtime from https://go.microsoft.com/fwlink/p/?LinkId=2124703 and restart the app. The app developer can get the distributable version of the WebView2 runtime.