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

Use promises if cb isn't passed in #34

Closed
wants to merge 1 commit into from
Closed

Conversation

clarkie
Copy link

@clarkie clarkie commented Feb 23, 2018

  • supports hapi v17

I'm a little out of my depth on this one but this fixed the issue I was having when using https://github.com/salzhrani/hapi-auth-jwt2/tree/v-17 with hapi v17 where I was getting the following error:

180223/145803.900, [error] message: Cannot match against 'undefined' or 'null'., stack: TypeError: Cannot match against 'undefined' or 'null'.
    at Object.authenticate (/Users/clarkie/code/tojs/server/node_modules/hapi-auth-jwt2/lib/index.js:126:115)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

Let me know if I need to do any more to this to handle the other cases.

// Provide the key.
return cb(null, key.publicKey || key.rsaPublicKey, key);
// Provide the key.
return resolve({ key: key.publicKey || key.rsaPublicKey });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to return the whole key here?
return resolve(Object.assign({}, key, { key: key.publicKey || key.rsaPublicKey }))

@L42y
Copy link

L42y commented Mar 12, 2018

Let's give this issue some love, so people can migrate to hapi v17 with ease.

@smessimer
Copy link

Any word on this? I'm trying to integrate Auth0 into a Hapi 17 project and am seeing this issue.

@aneilbaboo
Copy link

Fresh off the presses. A promisified version here: https://github.com/aneilbaboo/node-jwks-rsa-promisified

@clarkie @smessimer - let me know if it works for you.

nagyv added a commit to nagyv/node-jwks-rsa that referenced this pull request May 9, 2018
@jl-dos
Copy link

jl-dos commented Jul 11, 2018

Check out https://github.com/auth0/node-jwks-rsa/tree/master/examples/hapi-demo and the comments about the different function needed in the base module for v17 support. That plus the complete:true flag should get it all working.

@michalczukm
Copy link

michalczukm commented Aug 23, 2018

@jl-dos indeed, it works! Thanks for pointing it!
btw Its terribly hidden 😄

For other devs hitting this ticket:
I described how to use it in SO answer: https://stackoverflow.com/a/51995573/2029818

@clarkie clarkie closed this Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants