AADSTS500126: External ID token from issuer '{issuer}' failed signature verification.

Tony Liang 5 Reputation points
2024-10-27T14:50:25.19+00:00

Hi,

I've configured the external authentication method for Entra ID as outlined in the documentation. After successful authentication, our EAM system sends the ID token to https://login.microsoftonline.com/common/federation/externalauthproviderredirect. However, it appears that Entra ID is unable to verify the token, resulting in the following error:

Error: invalid_client

Error Description: AADSTS500126: External ID token from issuer '{issuer}' failed signature verification. KeyID of token is 'SigningKey'.

I’ve checked the token’s integrity on jwt.io, and it seems valid. Could you provide insights into why the token verification might be failing in Entra ID and any possible resolutions?

Thank you!

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. James Hamil 27,221 Reputation points Microsoft Employee Moderator
    2024-10-28T18:25:29.38+00:00

    Hi @Tony Liang , there are a few things that could be causing the problem:

    1. Incorrect Signing Key: Double-check the signing key. The KeyID (kid) in your token's header needs to match the key Entra ID is expecting. Look at the kid value in your token header. Make sure the corresponding public key is available in the JWKS (JSON Web Key Set) endpoint from your external provider. Verify that this key is correctly set up in Entra ID.
    2. Key Rotation: If your external provider has rotated keys recently, Entra ID might not have the latest key yet. Check if there’s been a recent key rotation. Make sure the new keys are updated and configured in Entra ID.
    3. Mismatched Issuer or Audience: The iss (issuer) and aud (audience) claims in the token need to match what Entra ID expects. Look at the iss and aud claims in your token. Verify that these match what you’ve configured in Entra ID.
    4. Make sure your token hasn’t expired. Check the exp claim in the token and confirm it’s still valid when Entra ID is verifying it.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James


  2. Nicolas P 0 Reputation points
    2025-02-25T09:34:57.77+00:00

    We finally managed to get it working !

    It seems that entra ID needs to have the JWKS encoded as such :

    • base64 url encoded without padding for all fields but the x5c field,
    • normal base64 for the x5c field.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.