Node JS Authentication error:Error getting token: AuthenticationRequiredError: network_error: Network request failed
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
}