Node JS Authentication error:Error getting token: AuthenticationRequiredError: network_error: Network request failed

Rishitha 0 Reputation points
2024-06-06T19:16:56.2833333+00:00

I have Graph API credentials and permissions to send an email from office mailbox. I was able to get the token, authenticate and send an email via my node js framework.

I had to reboot my local machine this morning. When I trigger the email execution, it throws the error.= below. The authentication and retrieving token is working in Postman but not in my framework. I haven't changed a single line of code. Should I update anything? Is this a network/firewall issue?

Error getting token: AuthenticationRequiredError: network_error: Network request failed

at handleMsalError (C:\node_modules\@azure\identity\dist\index.js:1564:12)

at withSilentAuthentication (C:\node_modules\@azure\identity\dist\index.js:2046:23)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async Object.withSpan (C:\node_modules\@azure\core-tracing\dist\commonjs\tracingClient.js:36:28)

at async CustomAuthenticationProvider.authProvider [as provider] (file:///C:/src/utils/Email/EmailDynamic.js:95:29) {

scopes: [ 'https://graph.microsoft.com/.default' ],

getTokenOptions: {

tracingOptions: { tracingContext: [TracingContextImpl] },

tenantId: 'myclientid'

}

}

Error sending mail: AuthenticationRequiredError: network_error: Network request failed

at handleMsalError {

statusCode: -1,

code: 'AuthenticationRequiredError',

requestId: null,

date: 2024-06-06T19:10:06.161Z,

body: 'AuthenticationRequiredError: network_error: Network request failed',

headers: undefined

}

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,277 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.