tekul/jose-jwt

Unable to decode JWK set

iand675 opened this issue · 1 comments

Hi there, I'm trying to use this library with Auth0 & their RS256 signed tokens. As part of that I'm downloading a JWK set they provide me and trying to decode it:

getJwks :: IO ()
getJwks = do
  manager <- getGlobalManager
  jwksUrl <- parseRequest "https://iand675.eu.auth0.com/.well-known/jwks.json"
  r <- httpLbs jwksUrl manager
  let body = responseBody r
  print body
  let result = eitherDecode body
  print (result :: Either String JWKSet)

However, there seems to be an issue with decoding the key provided in the set:

Left "Error in $.keys[0].x5t: incorrect number of bytes"

I am not terribly familiar with any aspect of JWTs and the associated specs, so I am a bit at a loss as to what is the matter here. Hoping you might have an idea of how to solve this.

Thanks!

tekul commented

From your code, I'd guess you're using the jose library rather than this one.

This library doesn't currently support the use of X.509 certificates in JWKs, so the x5t field is just of type Text which shouldn't give the error you show.

The field should be a SHA-1 hash and it looks to be the correct size (20 bytes).