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

Self signed certificates #106

Closed
RomanMinkin opened this issue Feb 22, 2019 · 2 comments
Closed

Self signed certificates #106

RomanMinkin opened this issue Feb 22, 2019 · 2 comments

Comments

@RomanMinkin
Copy link

Trying to use this library with the OAuth2.0/IODC server hosted with self signed certificate and getting this error on callback/verify call

error=unable%20to%20verify%20the%20first%20certificate

Is there a way to set something like new https.Agent({rejectUnauthorized: false} to the underlying request library?

Thank you in advance, pretty nice library btw!

@simov
Copy link
Owner

simov commented Feb 22, 2019

Does it work if you run the app with:

NODE_TLS_REJECT_UNAUTHORIZED=0 node app.js

Other than that the underlying HTTP client can be monkey-patched like this #93 (comment)

Let me know if any of the above works for you.

@RomanMinkin
Copy link
Author

@simov, yes, NODE_TLS_REJECT_UNAUTHORIZED=0 works, but it does it for all the connection in the process :(
Monkey-patche also worksm with a little addition is that grunt must be required right after and not before the patch

const request = require('grant/lib/client.js')
require.cache[require.resolve('grant/lib/client.js')].exports = (options) => {
  options.agent = new https.Agent({
    rejectUnauthorized: false,
  })
  return request(options)
}
const grant = require('grant-express')

Thank you for the quick replay!

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

No branches or pull requests

2 participants