Version Affected: 22.12 and later
Overview
When SecureAuth Identity Platform is configured as an external multifactor authentication (MFA) method in Microsoft Entra ID, users who choose SecureAuth during sign-in are stopped before they reach the SecureAuth realm. Entra ID shows the following error:
AADSTS5007413: Authentication with external provider cannot be completed due to invalid provider discovery response.The error page also lists a Request Id, Correlation Id and Timestamp. External MFA was previously called External Authentication Methods (EAM). The realm's discovery URL opens normally in a browser and returns valid JSON, so the cause is easy to miss.
Cause
The Issuer configured on the realm does not exactly match the base of the realm's OpenID Connect (OIDC) discovery URL.
Entra ID requires the issuer value in the discovery document to equal the discovery URL with /.well-known/openid-configuration removed, character for character. The same value must also appear as the issuer (iss) claim in every ID token (id_token) the realm returns to Entra ID. If any of the three differ, Entra ID rejects the discovery document with AADSTS5007413.
For a discovery URL of https://<host>/<realm>/.well-known/openid-configuration, the issuer values behave as follows:
- https://<host>/<realm> works.
- https://<host> fails with AADSTS5007413, because the realm path is missing.
- <host> with no https:// scheme fails with AADSTS5007413.
- https://<host>/<realm>/ with a trailing slash fails with AADSTS5007413.
Entra ID caches the metadata it reads from the discovery URL and refreshes it every 24 hours. Because of this, the error does not always appear or clear at the moment the issuer changes:
- An existing external MFA method can keep working with a non-matching issuer, then fail once the cache refreshes or the method is re-created.
- After the issuer is corrected, the error can continue until Entra ID fetches the corrected discovery document. Deleting and re-adding the external MFA method does not always force a fresh fetch.
Resolution:
To resolve this:
- In the SecureAuth Identity Platform admin console, open the realm used for Entra ID external MFA.
- Go to the realm's OIDC / OAuth 2.0 settings. On most versions they are on the Post Authentication tab.
- Set Issuer to https://<host>/<realm>, for example https://sso.example.com/SecureAuth2. Use https://, keep the realm name's casing exactly as it appears in the discovery URL, and do not add a trailing slash or a port that the discovery URL does not have.
- Save the realm.
- Open https://<host>/<realm>/.well-known/openid-configuration in a browser and confirm that issuer shows exactly the value set in step 3.
- In the Microsoft Entra admin center, go to Authentication methods, delete the external MFA method, and add it again with the same App ID, Client ID and Discovery URL.
- Assign the target users or groups to the method again.
- Sign in as a test user and choose SecureAuth as the MFA method.
If AADSTS5007413 continues after these steps, Entra ID is still using its cached copy of the old discovery document. Either wait up to 24 hours from the issuer change and test again, or, for an immediate fix:
- Create a new realm, for example <realm>2, configured the same way as the original, or create an alias in IIS for the same realm.
- Set the Issuer to the new realm or alias URL, for example https://<host>/<realm>2, before adding it to Entra ID, so Entra ID has never cached an incorrect value for it.
- Confirm the discovery document at the new realm or alias URL shows that issuer, as in step 5 above.
- In Entra ID, add a new external MFA method that points to the discovery URL of the new realm or alias, and assign the target users or groups to it.
Special Considerations
Changing the Issuer changes the iss claim in every ID token the realm issues, not only the tokens sent to Entra ID. Any other application that uses the same realm and validates iss will stop accepting the realm's tokens until it is updated with the new issuer. If the realm is shared with other applications, use a dedicated realm for Entra ID external MFA instead of changing the issuer on the shared one.
SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.
Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.
Comments
0 comments
Please sign in to leave a comment.