question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Returned error from jose.importJWK is squashed

See original GitHub issue

We had an issue where we were trying to debug the following error:

no valid key found in issuer's jwks_uri for key parameters {"kid":"jwa2A0ZH0Y4M_9HD-spX","alg":"RS256"}

The error is thrown at openid-client/lib/helpers/issuer.js:94:11.

After digging some time, I located the real source: https://github.com/panva/node-openid-client/blob/b3c0f3c5f800253dfd5fd793c63faccc0951148e/lib/helpers/keystore.js#L231

Our bug was missing “n” (modulus) and “e” (exponent) in some dev jwks keys. Because the error was squashed though, we could not see what happened.

I’ll be willing to make a PR for this if the owners agree the errors should be handled differently.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
simon-dkcommented, Dec 15, 2022

Thats a great point, and if that is the case it would of course not make sense to throw an error. A tiny bit more info in the log would have saved my day though. I’ll leave it at that and close this issue. Others who might get the same error now has a chance of reading about it here 🙃

It is not that common that authorization servers don’t know how to well form a JWK 😉

😄 Gladly it was some dev keys in a dev environment, not sure how they were generated, but I’ll have to look into that next.

0reactions
panvacommented, Dec 15, 2022

Likewise the error from jose is only ever good in one scenario that you happened to fall under but would completely throw off developers in others. It is not that common that authorization servers don’t know how to well form a JWK 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Various issues in jwt.decode / jws._get_keys #45 - GitHub
I've had a couple issues (figuring out how to use jwt.decode) which stem from the jws._get_keys implementation. key argument must be ...
Read more >
jose - npm
Implemented specs & features · JSON Web Signature (JWS) - RFC7515 · JSON Web Encryption (JWE) - RFC7516 · JSON Web Key (JWK)...
Read more >
creating JWK and JWS using jose, however getting error ...
in your code you try to load a key from a keystore that you filled with your own key, but the key is...
Read more >
node-jose - Cisco Developer
A JavaScript implementation of the JSON Object Signing and Encryption (JOSE) for current web browsers and node.js-based servers. This library implements ( ...
Read more >
@panva/jose - npm Package Health Analysis | Snyk
JSON Web Almost Everything - JWA, JWS, JWE, JWK, JWT, JWKS for Node.js with minimal dependencies For more information about how to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found