Coder Social home page Coder Social logo

Comments (10)

panva avatar panva commented on June 9, 2024 2

Well, this is a Node.js-only module. https://github.com/panva/node-openid-client/blob/main/README.md#how-do-i-use-it-outside-of-nodejs

How do I use it outside of Node.js

It is only built for Node.js. Other javascript runtimes are not supported. I recommend panva/oauth4webapi, or a derivate thereof, if you're looking for a similarly compliant and certified client software that's not dependent on the Node.js runtime builtins.

I can explain what's happening. jose dependency, which is used to import the JWK key material is a universal library.

So what happens is that Bun resolves jose's bun entrypoint which uses native WebCryptoAPI and ends up with a CryptoKey, not node's own crypto.KeyObject. So the check is doing exactly what it should be doing, ensuring it's working with node's crypto KeyObject.

For now I can only say that this module is meant to be used only in Node.js and this is not a bug. That being said, I can look into testing the library in Bun and/or Deno as well but it's not a priority for me.

from node-openid-client.

panva avatar panva commented on June 9, 2024

Hi @BRAVO68WEB

Are you running your code in Node.js, or some other runtime like Bun or Deno?

from node-openid-client.

BRAVO68WEB avatar BRAVO68WEB commented on June 9, 2024

Bun

Let me check with node too.

from node-openid-client.

BRAVO68WEB avatar BRAVO68WEB commented on June 9, 2024

Yep, I just now tried with node, it worked.

But, still can tell me why is that check present there?

from node-openid-client.

BRAVO68WEB avatar BRAVO68WEB commented on June 9, 2024

Thank you @panva for clearing my doubt pretty fast 😸.

from node-openid-client.

panva avatar panva commented on June 9, 2024

@Jarred-Sumner is there anything that can be done to have bun force to resolve a given dependency using a different algorithm (see my comment above)?

from node-openid-client.

panva avatar panva commented on June 9, 2024

I've released https://github.com/panva/node-openid-client/releases/tag/v5.6.0

This attempts to work around:

  • missing Node.js APIs in Bun
  • Bun's bugs in url.parse(..., true)
  • Bun loading jose's bun target instead of the require one

It is not possible to run openid-client's test suite due to other Bun Node.js compatibility bugs which is why this is "experimental" and this for now remains a Node.js only module.

Please let me know if you encounter any new issues when running openid-client in Bun.

from node-openid-client.

BRAVO68WEB avatar BRAVO68WEB commented on June 9, 2024

@panva I will try, and check back to you

from node-openid-client.

BRAVO68WEB avatar BRAVO68WEB commented on June 9, 2024

Hey @panva it works like a charm.
But currently facing a small issue relates to jose.

[0.04ms] ".env"
[1]    30000 segmentation fault  bun run -b --port 4000 --hot index.ts

I get this error when try to verify JWT with createRemoteJWKSet and jwtVerify from jose.

Waiting for your PR auth0/node-jwks-rsa#374 to get merged, then it will work fine.

from node-openid-client.

panva avatar panva commented on June 9, 2024

unlikely to be jose related, just jose triggered, please open an issue with bun. https://github.com/oven-sh/bun/issues

from node-openid-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.