title: Is there any java example of verification of JWT for aws cognito API?
body: <p>I am using aws cognito user pool, after user signed in, I got an id token at my single page application, which is expected, then for each request, I need to verify the id token at my backend rest API, which is in java, the aws doc didn't mention too much about how to do it. </p>
  
  <p>Is there any example for it?</p>
  
  <p>Confusions include:</p>
  
  <ol>
  <li><p>the id token seems not just a signed JWT, it's also encrypted, when use nimbus library, I need to specify a secret for an encrypted JWT, where can I get the secret? my understanding is this should come from aws, do I needed to download something and then put in my jvm keystore?</p></li>
  <li><p>there is a well-known jwts.json can be downloaded from aws, it looks like:</p></li>
  </ol>
  
  <p>`</p>
  
  <pre><code>{
      "keys": [
          {
              "alg": "RS256",
              "e": "AQAB",
              "kid": "HFPWHdsrG5WyulOwH5dai69YTsWz2KBB1NHbAcVx7M0=",
              "kty": "RSA",
              "n": "...",
              "use": "sig"
          },
          {
              "alg": "RS256",
              "e": "AQAB",
              "kid": "kSwTdVq/qD4Ra4Q8dJqUTlvOA7eiLxezOZ3mJKI61zU=",
              "kty": "RSA",
              "n": "....",
              "use": "sig"
          }
      ]
  }
  </code></pre>
  
  <p>`</p>
  
  <p>how to understand this, what does each property used for? is that every user in the user pool represents one key?</p>
  
  <ol start="3">
  <li>Is there any example java code for the aws cognito service verification, can I use aws sdk or I have to use library like nimbus to do the verification on my own?</li>
  </ol>