For development purposes, how can I call my local web api from auth0 rule

For development purposes, I want to call my local web api from auth0 rule. The error I get is (pulled from rules logs) -
Error: getaddrinfo ENOTFOUND
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) {
errno: ‘ENOTFOUND’,
code: ‘ENOTFOUND’,

My api has been configured for authentication in auth0. I get the access token and use this token to make the api call.
Here is my rule script -

function (user, context, callback) {
  const axios = require('axios');
  //Request the access token
  const options = { method: 'POST',
    url: `https://${auth0.domain}/oauth/token`,
    headers: { 'content-type': 'application/json' },
    data: `{"client_id":"${configuration.RULE_APP_CLIENT_ID}","client_secret":"${configuration.RULE_APP_CLIENT_SECRET}","audience":"","grant_type":"client_credentials"}` };
    .then( res => {
      const access_token =;
      const apiCallOpts = { method: 'GET',
                            url: '<path>',
                            headers: { authorization: `Bearer ${access_token}`}
      axios(apiCallOpts).then(apiRes => {
      }).catch( err => {
    return callback(null, user, context);
    .catch( err => {

NOTE: In my dev environment (windows 10) I did create inbound rules for the IP addresses mentioned here for US region.

It looks like this error is stating that the URL provided cannot be resolved, or doesn’t exist.

Thank you for your reply. I have created the entry in my host file as follows -

Is this approach valid for development purposes? Or do I have to publish my api to a publically accessible url?

The rule is running in a container in the cloud, so yes, it needs to accessible from there. The host file is like a static DNS for your machine IIRC.

Sounds good! Thank you Dan!

1 Like

No problem. Let us know if you have any other questions.