# ManagementClient.tickets.changePasswordのAgent設定について

**URL:** <https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520>\
**Category:** Get Help\
**Tags:** tickets, management-api\
**Created:** [December 5, 2024, 7:11am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520 "2024-12-05T07:11:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 5, 2024, 7:11am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/1 "2024-12-05T07:11:45Z")

</div>

・Proxyserver([http://aaaa.bbb.ccc:8080](http://aaaa.bbb.ccc:8080))を経由して、  
「auth0.ManagementClient.tickets.changePassword」(パスワード変更のチケット取得)を実行させたい。  
・使用しているパッケージは、「auth0」(version 4.14.0)

* * *

const https = require(‘https’);  
const auth0 = require(‘auth0’);

const hAgent = https.Agent({ host: ‘aaaa.bbb.ccc’, port: 8080 });  
const mgmt\_setting = {  
domain: \<AUTH0\_MGMT\_DOMAIN\>,  
clientId: \<AUTH0\_MGMT\_CLIENT\_ID\>,  
clientSecret: \<AUTH0\_MGMT\_CLIENT\_SECRET\>,  
agent: hAgent  
};

const params = {  
user\_id: ‘\<TAGET\_USER\_ID\>’,  
client\_id: \<AUTH0\_REDIRECT\_CLIENT\_ID\>,  
};

## const mgmtRespose = await mgmt.tickets.changePassword(params); ticket = mgmtRespose.data.ticket;

実行するとエラーとなる。  
メッセージ「FetchError: The request failed and the interceptors did not return an alternative response」

「hAgent」の実装が間違っているのか？

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 5, 2024, 9:29am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/2 "2024-12-05T09:29:26Z")

</div>

・Via the proxy server ([http://aaaa.bbb.ccc:8080](http://aaaa.bbb.ccc:8080)),  
I want to execute “auth0.ManagementClient.tickets.changePassword” (obtain a password change ticket).  
・The package used is “auth0” (version 4.14.0)

* * *

const https = require(‘https’);  
const auth0 = require(‘auth0’);

const hAgent = https.Agent({ host: ‘aaaa.bbb.ccc’, port: 8080 });  
const mgmt\_setting = {  
domain: \<AUTH0\_MGMT\_DOMAIN\>,  
clientId: \<AUTH0\_MGMT\_CLIENT\_ID\>,  
clientSecret: \<AUTH0\_MGMT\_CLIENT\_SECRET\>,  
agent: hAgent  
};

const params = {  
user\_id: ‘\<TAGET\_USER\_ID\>’,  
client\_id: \<AUTH0\_REDIRECT\_CLIENT\_ID\>,  
};

## const mgmtRespose = await mgmt.tickets.changePassword(params); const ticket = mgmtRespose.data.ticket;

An error will occur if you run it.  
Message “FetchError: The request failed and the interceptors did not return an alternative response”

Is the implementation of “hAgent” wrong?

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 6, 2024, 4:45pm UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/4 "2024-12-06T16:45:38Z")

</div>

Hi @xkinjyou,

Welcome to the Auth0 Community!

I found this Community article that discusses this error: [Solution for Error "The Request Failed and the Interceptors did not Return an Alternative Response"](https://community.auth0.com/t/solution-for-error-the-request-failed-and-the-interceptors-did-not-return-an-alternative-response/134219)

Can you kindly give that a review?

Best,

Mary Beth

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 9, 2024, 12:32am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/5 "2024-12-09T00:32:43Z")

</div>

Thank you for your reply.

The explanation was insufficient.

If there is no option “agent”, it is working normally.  
When the option “agent” is included, the following error occurs.  
Message “FetchError: The request failed and the interceptors did not return an alternative response”

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 9, 2024, 10:55pm UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/6 "2024-12-09T22:55:46Z")

</div>

Hi @xkinjyou,

I understand! I confirmed that the `ManagementClient` takes the `agent` property: [ManagementClientOptions | auth0](https://auth0.github.io/node-auth0/interfaces/management.ManagementClientOptions.html#agent)

It is defined here: [node-auth0/src/lib/models.ts at a7d08705f94f4515bed8811297e4b8c8b340aebb · auth0/node-auth0 · GitHub](https://github.com/auth0/node-auth0/blob/a7d08705/src/lib/models.ts#L29)

I took a look at the `https` module and am unclear on what is expected using `https.Agent`. Some docs say an array, and some have it as an object, as you do.

Alternatively, I wonder if you are affected by this documented `dd-trace` issue: [Node-sdk; Management Client; FetchError: The request failed and the interceptors did not return an alternative response - #4 by crummy](https://community.auth0.com/t/node-sdk-management-client-fetcherror-the-request-failed-and-the-interceptors-did-not-return-an-alternative-response/132714/4)

I am going to keep looking into `http` module and try to reproduce/get the `agent` property to work in an Action of mine and will get back to you as soon as I can.

Thanks,

Mary Beth

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 10, 2024, 1:20am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/7 "2024-12-10T01:20:11Z")

</div>

Thank you for your reply.

I would expect that by using an agent I would be able to access it via a proxyserver.  
I know you are busy, but please check.

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 11, 2024, 10:50pm UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/8 "2024-12-11T22:50:45Z")

</div>

Hi @xkinjyou,

I did some more research into `https` and `https.Agent` and see that there are some issues with `https.Agent`. Can you try using `http-proxy-agent`? You will need to install it, configure it, and update the action to something like this:

```auto
const auth0 = require('auth0');
const https = require('https');
const HttpProxyAgent = require('http-proxy-agent'); // Import the proxy agent

// Define the proxy agent for your server
const proxyUrl = 'http://aaaa.bbb.ccc:8080'; // Your proxy server URL
const agent = new HttpProxyAgent(proxyUrl); // Create the agent

const mgmtClient = new auth0.ManagementClient({
  domain: '<AUTH0_MGMT_DOMAIN>',
  clientId: '<AUTH0_MGMT_CLIENT_ID>',
  clientSecret: '<AUTH0_MGMT_CLIENT_SECRET>',
  agent: agent // Use the proxy agent here
});

```

`http-proxy-agent`: [http-proxy-agent - npm](https://www.npmjs.com/package/http-proxy-agent)

Please let me know how this goes!

Best,

Mary Beth

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 12, 2024, 12:41am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/9 "2024-12-12T00:41:39Z")

</div>

Thank you for your reply.

The same error message was output.  
“https-proxy-agent” had the same result.

Also, in the case of auth0 (version 3.4.0), the option “proxy” can be used successfully.

## ※Below is the source that was executed this time.

const auth0 = require(‘auth0’);  
const https = require(‘https’);  
const {HttpProxyAgent} = require(‘http-proxy-agent’); // Import the proxy agent

// Define the proxy agent for your server  
const proxyUrl = ‘[http://aaaa.bbb.ccc:8080](http://aaaa.bbb.ccc:8080)’; // Your proxy server URL  
const agent = new HttpProxyAgent(proxyUrl); // Create the agent

## const mgmtClient = new auth0.ManagementClient({ domain: ‘\<AUTH0\_MGMT\_DOMAIN\>’, clientId: ‘\<AUTH0\_MGMT\_CLIENT\_ID\>’, clientSecret: ‘\<AUTH0\_MGMT\_CLIENT\_SECRET\>’, agent: agent // Use the proxy agent here });

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 16, 2024, 4:36am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/10 "2024-12-16T04:36:06Z")

</div>

I haven’t received an answer, so please tell me the following.  
In “auth0” (version 4.14.0), instead of using the option “agent”,  
Is there another way to run “auth0.ManagementClient.tickets.changePassword” via proxyserver ([http://aaaa.bbb.ccc:8080/](http://aaaa.bbb.ccc:8080/))?

---

<div class="post-metadata">

**Author:** ![MansionTeam](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mansionteam/32/60892_2.png) [@MansionTeam](https://community.auth0.com/u/MansionTeam)\
**Post date:** [December 16, 2024, 5:42am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/11 "2024-12-16T05:42:44Z")

</div>

Hallo, you try use chatgpt to resolve your problem?

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 17, 2024, 2:11am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/12 "2024-12-17T02:11:07Z")

</div>

Thank you for your feedback.  
It’s not mentioned in the official documentation, so I don’t think CHATGPT can answer it, but I’ll give it a try.

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 17, 2024, 10:42pm UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/13 "2024-12-17T22:42:35Z")

</div>

@xkinjyou,

Thanks for your patience! I’ve been looking into this and would like to confirm that your proxy is formatted and working correctly. Can you confirm the below:

**Verify Proxy URL Format:** Ensure that the proxy URL is in the correct format. The `http-proxy-agent` expects URLs in a specific format, and it’s critical that the URL you’re using is correctly specified.

```auto
const proxyUrl = 'http://aaaa.bbb.ccc:8080'; // Ensure this is valid

```

**Ensure Auth0 SDK and Proxy Integration:** You are correctly passing the `agent` to the `ManagementClient`, but you might also need to ensure that the HTTP request is being routed through the proxy properly. Verify that the proxy configuration works with other requests (e.g., a basic `https` request using `https.request` with the proxy agent).

**Check Proxy Server:** Make sure the proxy server is reachable and is correctly forwarding traffic. You can test this with simple HTTP requests using tools like `curl` or Postman. Check whether requests to your proxy server are being properly routed to the Auth0 API endpoints.

**Debugging Proxy Connectivity:** To debug if the proxy agent is working as expected, you can try making a simple `https` request through the proxy server:

```auto
const https = require('https');
const { HttpProxyAgent } = require('http-proxy-agent');

const proxyUrl = 'http://aaaa.bbb.ccc:8080'; // Proxy server URL
const agent = new HttpProxyAgent(proxyUrl);

https.get('https://your-auth0-api-url.com', { agent }, (res) => {
  res.on('data', (chunk) => {
    console.log(chunk.toString());
  });
}).on('error', (e) => {
  console.error(`Request failed: ${e.message}`);
});

```

This will help you verify that your proxy setup is functioning correctly.

**Check Network Interceptors:** The error message you’re getting mentions that “the interceptors did not return an alternative response.” This could be related to some internal logic in the `auth0` SDK or possibly an interceptor blocking the request. You might want to check if there are any interceptors in your environment (either in your code or in your network). Sometimes, these interceptors are used to modify requests before they are sent or responses before they are returned.

**Alternative Debugging via `request` or `axios` with Proxy:** If the issue persists with `auth0`, as a test, you could use `axios` or `request` (both support proxies well) to make the same API request and check if it’s a proxy-related issue or something specific to the `auth0` SDK.

Can you let me know the result of the above checks?

Thanks,

Mary Beth

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 18, 2024, 1:46am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/14 "2024-12-18T01:46:49Z")

</div>

Thank you for your reply.

The following is the requested console.log.

```auto
<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>cloudflare</center>
</body>
</html>

```

Do I need to change the proxyserver configuration in this case?  
It was working fine with auth0 (version 3.4.0), so I would like to avoid it if possible.

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 19, 2024, 11:02pm UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/15 "2024-12-19T23:02:36Z")

</div>

Hi @xkinjyou,

Thank you for your testing! Please allow me some time to look into this more.

Thanks,

Mary Beth

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 20, 2024, 4:24am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/16 "2024-12-20T04:24:30Z")

</div>

Thank you very much in advance for your assistance.

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [December 23, 2024, 12:14am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/18 "2024-12-23T00:14:01Z")

</div>

I would like to report it.How do I report it?

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [December 30, 2024, 10:19pm UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/19 "2024-12-30T22:19:56Z")

</div>

Hi @xkinjyou,

Thank you for your continued patience! We’ve been off for the holidays. I’m still looking into this issue, but if you would like to submit feedback you can follow this guide: [How to Submit Product Feedback or Feature Requests](https://community.auth0.com/t/how-to-submit-product-feedback-or-feature-requests/22150)

Additionally, you can submit a support ticket here if your plan allows: [https://support.auth0.com/](https://support.auth0.com/)

Thanks,

Mary Beth

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [January 8, 2025, 4:26am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/21 "2025-01-08T04:26:29Z")

</div>

It has been a long time since I last contacted you.  
How long will the investigation take?  
Is there another alternative?

---

<div class="post-metadata">

**Author:** ![xkinjyou](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xkinjyou/32/65010_2.png) [@xkinjyou](https://community.auth0.com/u/xkinjyou)\
**Post date:** [January 20, 2025, 8:59am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/22 "2025-01-20T08:59:19Z")

</div>

> Additionally, you can submit a support ticket here if your plan allows: \>[https://support.auth0.com/](https://support.auth0.com/)

→Should I contact you using this support link?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 3, 2025, 8:59am UTC](https://community.auth0.com/t/managementclient-tickets-changepassword-agent/157520/23 "2025-02-03T08:59:32Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
