Get "kid" field from JWT header

Issue #21 resolved
Former user created an issue

Hi Brian,

thanks for your great library!

How can I retrieve the "kid" header from a JWT?

Thanks! Marco

Comments (3)

  1. Brian Campbell repo owner

    The getKeyIdHeaderValue() on JsonWebSignature (and JsonWebEncryption) will give you the kid value.

    You might also want to consider using JwtConsumer[Builder] with maybe a HttpsJwksVerificationKeyResolver or JwksVerificationKeyResolver, which use the kid to select from key(s) for verification. But they do a lot of the work for you.

    https://bitbucket.org/b_c/jose4j/wiki/JWT%20Examples#markdown-header-using-an-https-jwks-endpoint

    https://bitbucket.org/b_c/jose4j/wiki/JWT%20Examples#markdown-header-using-jwks

  2. Log in to comment