function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mrunali GaonkarMrunali Gaonkar 

Getting 401 unauthorized error when trying authenticate user in SPO using MSAL.

Has anyone worked on Microsoft Authentication Library (MSAL V2.0)?
MSAL Link: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser

Scenario:
Users are using Microsoft credentials to access all the applications. I am trying to authenticate SharePoint URL from Salesforce. I have set up a Microsoft Azure application. Using MSAL, I am able to get the access token for the current logged-in Microsoft user account in Salesforce. When I try to authenticate SharePoint URL with an access token, I am getting 401 unauthorized error.

Does anyone have any idea about this? I am wondering if I need to do any application-specific changes in the Microsoft Azure application. Thanks.
Malika Pathak 9Malika Pathak 9
Hi Mrunali,
This might help you

https://github.com/AzureAD/microsoft-authentication-library-for-python/issues/243

Kindly mark this as the best answer, If you find this answer helpful.
Jaydeep HiraniJaydeep Hirani
Hello Mrunali,

How did you integrated MSAL.js (v2) into Salesforce and how did you use it to authenticate user..Can you please provide steps or code for this.