Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise Methods #76

Closed
shellscape opened this issue Jan 30, 2019 · 8 comments
Closed

Promise Methods #76

shellscape opened this issue Jan 30, 2019 · 8 comments
Assignees
Milestone

Comments

@shellscape
Copy link

Not to be curt, but it's 2019 folks. Callbacks are relics and Promise is the way forward. The last version of Node that doesn't support async/await out of the box is on its last leg and will soon drop out of LTS. Can we please get an updated version that doesn't solely rely on callbacks?

@stale
Copy link

stale bot commented Oct 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

@stale stale bot added the closed:stale Issue or PR has not seen activity recently label Oct 26, 2019
@stale stale bot closed this as completed Nov 2, 2019
@shellscape
Copy link
Author

@joshcanhelp aggressive bot is overly aggressive. please don't dismiss my issue and the 18 upvotes this issue received.

@cocojoe
Copy link
Member

cocojoe commented Nov 4, 2019

Agreed, sorry about that. The bot appears to be a little over zealous in its desire to close issues.

@cocojoe cocojoe reopened this Nov 4, 2019
@stale stale bot removed the closed:stale Issue or PR has not seen activity recently label Nov 4, 2019
@joshcanhelp joshcanhelp self-assigned this Nov 4, 2019
@shellscape
Copy link
Author

Thank you for the re-open.

@dmi3y
Copy link

dmi3y commented Dec 5, 2019

There is https://github.com/aneilbaboo/node-jwks-rsa-promisified

@the-architect
Copy link

Just found out about this, so maybe someone else can use it too.

You can promisify callback methods like this:

const { promisify } = require("util");
const jwksClient = require("jwks-rsa");

...

const client = jwksClient({ <yourOptions> });

// promisify the function:
const getSigningKey = promisify(client.getSigningKey);

// use it like any other promise:
const key = await getSigningKey(kid);

@joshcanhelp joshcanhelp removed their assignment Jan 31, 2020
@davidpatrick davidpatrick self-assigned this Mar 9, 2020
@davidpatrick davidpatrick added this to the v2-Next milestone Mar 9, 2020
@vinerich
Copy link

I know this is a node library but I'd also like to be able to use this on frontend sites to verify tokens.

The next part can be wrong, only starting with js in browsers so correct me here:

  • Through the callbacks setImmediate() is used, which is supported by node but not by browsers.
  • This is not supported in any browser except Microsofts IE/Edge https://caniuse.com/#feat=setimmediate.

So please don't just promisify the existing callbacks, since this will not change the call to setImmediate().

@ken5scal
Copy link

I'm experiencing the same behavior in spa as @vinerich described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants