Problem statement
We are using auth0 - npm npm package from the internal network but call is not reaching Auth0 and timing out. Since the script is running inside the enterprise network, we either need to open a firewall or use enterprise proxy to connect to Auth0 on the Internet.
Does Auth0 npm package be configured to use enterprise proxy server to connect to Auth0?
Solution
Using Charles proxy:
You can successfully connect to Auth0 through a proxy with the node-auth0 client. Sample code can be found below:
const { ManagementClient } = require('.');
const mngmt = new ManagementClient({
domain: 'brucke.auth0.com',
token: 'my-token',
proxy: 'http://localhost:8888';, // Charles Proxy
});
(async () => {
try {
console.log(await mngmt.clients.getAll());
} catch (e) {
console.log(e);
}
})();