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

ignore self signed certificate issue in request-promise #225

Open
jkjha opened this issue Sep 21, 2017 · 9 comments
Open

ignore self signed certificate issue in request-promise #225

jkjha opened this issue Sep 21, 2017 · 9 comments

Comments

@jkjha
Copy link

jkjha commented Sep 21, 2017

I am using request-promise module for my node app to make some API call. https://www.npmjs.com/package/request-promise

import request from 'request-promise';
let options = {
                method: GET,
                json: true,
                uri : "https://" +this.urls + endpoint,
                body: payload,
                rejectUnauthorized: false // This doesn't work
            };

let response = await request(options)

SInce the API what I am trying to use is insecure (having self signed certificate), the conncetion is failing with this error:

Error: connect ECONNREFUSED
I know with "request" module, we could pass rejectUnauthorized: false , to handle such case. I am not sure how can I pass such option with request-promise module.

@ecdeveloper
Copy link

Add insecure: true to your options. So it looks like

let options = {
                method: GET,
                json: true,
                uri : "https://" +this.urls + endpoint,
                body: payload,
                insecure: true
            };

@analog-nico
Copy link
Member

@ecdeveloper Thanks for helping out! Quick question: Where did you find this option? Is it one that request forwards to the internal node libraries and which is documented in the node.js docs?

@jkjha Just in case insecure: true doesn’t work have a look at the section about agentOptions in the request README. It explicitly mentions the case of using self-signed certificates. Btw, all options for request work for request-promise as well.

@ajaysaini-sgvu
Copy link

+1

@Elyx0
Copy link

Elyx0 commented Apr 9, 2018

Having the same issue, insecure true didn't solve it but rejectUnauthorized: false did

@zglozman
Copy link

So I need to implement access to an mTLS protected resourcese, that means in neeed to provide the the CA which signed the service i am trying to access, as well as my own certificate and privateKey. what would use for that?

@longbowww
Copy link

Having the same issue, insecure true didn't solve it but rejectUnauthorized: false did

does nothing for me, i just get a different kind of error - still saying self signed

@rhulha
Copy link

rhulha commented Jun 5, 2019

Adding both options seems to work for me :)

@omaracrystal
Copy link

strictSSL: false

worked for me

And also making sure that json: true was taken out... or commented out

@iAbhinav
Copy link

This works for me in request.get

request.get(url, {rejectUnauthorized: false}, function(err, res, body)

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

10 participants