Calling auth0 api endpoints from another server

I’ve got 2 servers - 1) A python server
2) A node server
Both of the servers are intergrated with auth0.
I need to call a few endpoints of the python server from the node server. What steps should I follow?

Hi @rohan1

It depends on the context. For a “machine-to-machine” call, use client credentials: https://auth0.com/docs/flows/client-credentials-flow

But if the node server is making a call to the python server on behalf of a user, you need to pass the user’s access token in the call.

John

Thanks

So while calling the python api from my node api I’m getting the following error
Code
var request = require(“request”);

var options = {
  method: 'GET',
  url: 'https://myapi.com/api',
  headers: {'content-type': 'application/json', authorization: 'Bearer ACCESS_TOKEN'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Error

Error: Error: getaddrinfo ENOTFOUND dev.auth0.getmartini.com dev.auth0.getmartini.com:443
    at Request.request [as _callback] (/Users/rohanxyzg/narus/martini-api/random.js:38:15)
    at self.callback (/Users/rohanxyzg/narus/martini-api/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.onRequestError (/Users/rohanxyzg/narus/martini-api/node_modules/request/request.js:881:8)
    at ClientRequest.emit (events.js:182:13)
    at TLSSocket.socketErrorListener (_http_client.js:399:9)
    at TLSSocket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)