Forum Discussion

Alex_Lu's avatar
Alex_Lu
Copper Contributor
Jul 16, 2020

ID token issued by AAD doesn't match public signing key

Hi,

 

I've encountered an issue that ID tokens (JWT) issued by AAD do not match a public signing key. 

 

This is my JWKS url: https://login.microsoftonline.com/1d063515-6cad-4195-9486-ea65df456faa/discovery/v2.0/keys

 

However the ID token I receive has a unmatched kid like below

 

{
  "typ": "JWT",
  "alg": "RS256",
  "kid": "ylQQc6jLgNEIt8AMAPm8jR27QCE"
}

 

 

It's been working fine until a couple of days ago. It is mentioned somewhere that AAD rotates public keys but it seems tokens might be persisted without knowledge that the signing key has changed. 

 

However access token match one of the keys like

 

{
  "typ": "JWT",
  "nonce": "ExKWqBKO2TvzbusXVkALk0RQhka3YiNxEKQg69gs27Q",
  "alg": "RS256",
  "x5t": "huN95IvPfehq34GzBDZ1GXGirnM",
  "kid": "huN95IvPfehq34GzBDZ1GXGirnM"
}

 

 

Is this the expected behaviour? AAD is my IDP and AWS Cognito is the auth server in my set up. Because of this issue, Cognito is unable to verify signature of ID tokens therefore users can sign in but cannot proceed further because of this.

 

Has anyone come across a similar issue before?

Resources