Using Proxy with Auth0 ManagementClient

Last Updated: Dec 16, 2024

Overview

When using the npm package from the Internal Network, the API call does not reach Auth0 and times out. Since the script is running inside the Enterprise Network, either need to open a firewall or use an Enterprise proxy to connect to Auth0 on the Internet.
Does the Auth0 npm package be configured to use an enterprise proxy server to connect to Auth0?

Applies To

  • Auth0 ManagementClient
  • Proxy

Solution

Using Charlesproxy would successfully connect to Auth0 through a proxy with the node-auth0 client:

Example:

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);
  }
})();