question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to configure request config for httpsAgent

See original GitHub issue

Hi guys,

I have difficulties on configuring apisauce specific for httpsAgent. What i want to achieve is, i want to the client to check certificate of secure service i accessing, more popular term is certificate pinning. Axios itself have support for this as explained here.

So here is what i try to do :

var https = require(https);
// unable to load https module since it is built-in Node module
const api = apisauce.create({
	baseURL,
	headers: {
		'Cache-Control': 'no-cache',
		Accept: 'application/json',
		'Content-Type': 'application/json'
	},
	httpsAgent: new https.Agent({
		//public CER
		ca: 'cer-file.cer'
	}),
	timeout: 10000
});

I notice the problem is when i call https module which are built in node module.

var https = require(https);

Is there other way to configure this to able to run in react-native apps?

There is node.js http module substitution for react-native, but i couln’t find one for https.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
zhakygngcommented, Mar 22, 2019

Hi @SamiChab, i already tried react-native-pinch on my project and successfully implementing certificate pinning. Last time i work for this project is april last year, i couldn’t verify if this is still working or not today.

What i do is replacing all apisauce REST API call implementation with react-native-pinch. Also additional work on parsing react-native-pinch response & error to become apisauce compatible.

0reactions
worldofchucommented, Nov 25, 2022

I want get a npm package https, because i can’t download from the npm addr.so who can help me!thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure axios to use SSL certificate? - Stack Overflow
It should be noted that I am using axios to make the request. I attach my agent configuration in axios. const httpsAgent =...
Read more >
axios error unable to verify the first certificate - You.com
You do that by configuring the https agent in axios - have a look at this answer for an example : How to...
Read more >
HTTPS Authorized Certs with Node.js - Circle Engineering
Let's alter the server by setting requestCert and rejectUnauthorized to true in the options and adding a bit to the console.log line. var...
Read more >
Unable to get any response from the apple pay
I am integrating the apple pay and following the payment request api! ... I have fulfilled server setup and environment setup requirements with...
Read more >
Axios Cheat Sheet - Kapeli - Dash for macOS
Request Config ; : '/user ; // `baseURL` will be prepended to `url` unless `url` is absolute. // It can be convenient to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found