Hi @Hemant Ashok Greetings! Thank you for posting this question here.
You may be setting the scope wrong when getting the access token using the MSAL library. Referring to the document How to Acquire token for an API I could see that the format to apply scopes
is as follows scopes: ["user.read"]
. You can then extract the access token in the desired format for the API by following the below snippet.
const accessTokenRequest = {
scopes: ["user.read"],
account: accounts[0],
};
instance
.acquireTokenSilent(accessTokenRequest)
.then((accessTokenResponse) => {
// Acquire token silent success
let accessToken = accessTokenResponse.accessToken;
// Call your API with token
If the above approach does not work and you are using Account credentials to get access token, please refer to a solution shared on a similar thread How to get SharePoint site logo using Graph? which provides an alternate approach of acquiring token using an API end point.
Hope this helps! Please let us know if you have any additional questions or need further assistance.
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.