I would like support troubleshooting a sign on error. For background, I am building an application that accesses data stored on SharePoint. I am experiencing an issue generating the necessary auth token using Node.js. As I am in development, I want acquire a token using Username and Password.
I repurposed the code here: https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-desktop-acquire-token-username-password?tabs=nodejs
Using Python, I was successful. However using Node.js I received the below error.
Note: I am certain that the username and password were the same in both Python and Node.
ServerError: invalid_grant: 50126 - [2023-07-17 03:39:10Z]: AADSTS50126: Error validating credentials due to invalid username or password.
Trace ID: 94e3ad62-7ce3-4556-b8bf-d0cb5b1e2800
Correlation ID: 0f26b304-73ce-4626-bbb4-1ed38a8c51b8
Timestamp: 2023-07-17 03:39:10Z - Correlation ID: 0f26b304-73ce-4626-bbb4-1ed38a8c51b8 - Trace ID: 94e3ad62-7ce3-4556-b8bf-d0cb5b1e2800
at ServerError.AuthError [as constructor] (C:\Projects\TerrComm\tp-scheduler\node_modules\@azure\msal-node\node_modules\@azure\msal-common\dist\index.cjs.js:499:24)
at new ServerError (C:\Projects\TerrComm\tp-scheduler\node_modules\@azure\msal-node\node_modules\@azure\msal-common\dist\index.cjs.js:3398:28)
at ResponseHandler.validateTokenResponse (C:\Projects\TerrComm\tp-scheduler\node_modules\@azure\msal-node\node_modules\@azure\msal-common\dist\index.cjs.js:5429:19)
at UsernamePasswordClient.<anonymous> (C:\Projects\TerrComm\tp-scheduler\node_modules\@azure\msal-node\node_modules\@azure\msal-common\dist\index.cjs.js:7231:41)
at step (C:\Projects\TerrComm\tp-scheduler\node_modules\@azure\msal-node\node_modules\@azure\msal-common\dist\index.cjs.js:79:23)
at Object.next (C:\Projects\TerrComm\tp-scheduler\node_modules\@azure\msal-node\node_modules\@azure\msal-common\dist\index.cjs.js:60:53)
at fulfilled (C:\Projects\TerrComm\tp-scheduler\node_modules\@azure\msal-node\node_modules\@azure\msal-common\dist\index.cjs.js:50:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errorCode: 'invalid_grant',
errorMessage: '50126 - [2023-07-17 03:39:10Z]: AADSTS50126: Error validating credentials due to invalid username or password.\r\n' +
'Trace ID: 94e3ad62-7ce3-4556-b8bf-d0cb5b1e2800\r\n' +
'Correlation ID: 0f26b304-73ce-4626-bbb4-1ed38a8c51b8\r\n' +
'Timestamp: 2023-07-17 03:39:10Z - Correlation ID: 0f26b304-73ce-4626-bbb4-1ed38a8c51b8 - Trace ID: 94e3ad62-7ce3-4556-b8bf-d0cb5b1e2800',
subError: ''
}