I try to connect to msgraph to read data with msgraphClientV3 from a spfx webpart.
I followed this :
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis
I want to get result from /me/memberOf endpoint. I added these in my packageSolution File :
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "User.Read"
},
{
"resource": "Microsoft Graph",
"scope": "User.ReadBasic.All"
},
{
"resource": "Microsoft Graph",
"scope": "Directory.Read.All"
}
]
and call it with :
context.msGraphClientFactory
.getClient("3")
.then((client: MSGraphClientV3): void => {
client.api('/me/memberOf')
.get((error, messages: any, rawResponse?: any) => {
console.log("***********result*********")
if (error)
console.log(error)
else
console.log(messages?.value);
})
})
when I try I have this error message :
Error: Insufficient privileges to complete the operation.
Anyone know where I make a mistake ?