title: Getting error while decoding JWT generated by AWS Cognito in spring security
body: <p>We have suddenly started getting below <code>error</code> while <code>decoding</code> JWT generated by AWS Cognito.
  Spring Security JWT</p>
  
  <pre><code>{
      "error": "access_denied",
      "error_description": "Invalid token does not contain resource id (oauth2-resource)"
  }
  </code></pre>
  
  <p>We re using Spring boot version : 2.0.3.RELEASE</p>
  
  <p>This is more specific to tokens generated by AWS Cognito.And why it stopped working all of sudden with no changes in code base/spring lib or infra</p>
  
  <hr>
  
  <p>Latest update : 
  Seems AWS has reverted thr change(addition of 'aud claim) below decoded JWT tells the story</p>
  
  <p>Todays(16 Oct 2019) JWT</p>
  
  <pre><code> {
      "sub": "XXXXXXXXXXXX-6a8dd388a720",
      "token_use": "access",
      "scope": "XXXXXXXXXXXX",
      "auth_time": 1571227222,
      "iss": "YYYYYYYYYYYYYYYY",
      "exp": 1571230822,
      "iat": 1571227222,
      "version": 2,
      "jti": "XXXXXXXXXXXXXYYYYYYYYYYYYY",
      "client_id": "someclient_id",
      "username": "someusername"
       }
  </code></pre>
  
  <p>Yesterday we were getting : </p>
  
  <pre><code>  {
    "sub": "xxxxxxxxxxxxx",
    **"aud": "sameasclientid",**
    "token_use": "access",
    "scope": "somescope",
    "auth_time": 1571132619,
    "iss": "rrrrrrrrrrrrrrrrrrrrr",
    "exp": 1571136219,
    "iat": 1571132619,
    "version": 2,
    "jti": "xxxxxxxxxxxxxxxxx",
    "client_id": "sameasclientid",
    "username": "someusername"
   }
  </code></pre>