Validate JWT in a C# AWS lambda function

Hello Vlad,

Your first link gave me the information I was missing: the key id (kid) of the public key can be found in the token header.
So, I can read the Json web key set and store it as a dictionary (kid, public key). When I need to validate a token, I just need to read the kid in the header and find the corresponding public key.

Here is how to read the kid:

private string GetKid(string authToken)
{
    var handler = new JwtSecurityTokenHandler();
    JwtSecurityToken? token = handler.ReadJwtToken(authToken);
    return token.Header.Kid;
}

Thank you very much.