network_error - Azure AD MSAL Node.JS

Mr. Genesis 1 Reputation point
2022-09-02T15:51:32.757+00:00

Hello!
I am trying auth using Node.JS, but when the app send the validation data throw an error and I not found what I am doing wrog.

237412-image.png

Text of message:
errorMessage: 'Network request failed. Please check network trace to determine root cause. | Fetch client threw: Error: Error: read ECONNRESET | Attempted to reach: https://login.microsoftonline.com/2bd70d8a-6f4e-4cc1-aa00-469ce9c54770/oauth2/v2.0/token'

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,829 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Cristian SPIRIDON 4,471 Reputation points
    2022-09-03T14:10:36.823+00:00

    Hi,

    The error says that you can't reach that url.

    Do you have basic internet connectivity from that machine?
    Do you have any firewall rules that prevents you from reaching login.microsoftonline.com?

    Hope this helps!

    0 comments No comments

  2. 2022-10-03T21:35:10.17+00:00

    Hello @Mr. Genesis and thanks for reaching out. You code looks good. ECONNRESET means the other side of the TCP conversation abruptly closed its end of the connection. Since you're able to reach the /authorize endpoint and as @Cristian SPIRIDON suggests, you may have a (web) firewall or proxy blocking POST requests.

    Try running the code from a device in a network without proxy or firewall, it should work. Please reach your networking team to ensure POST requests to the /token endpoint are not being blocked or come back to us for additional debugging instructions.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and complete the quality survey so that others can find a solution.