I am working on posting a message in Microsoft Teams on behalf of an actual User using Microsoft Graph API but getting the below error:
User Id must match the api caller when called in delegated mode
The full error response is below:
{
"error": {
"code": "Unauthorized",
"message": "User Id must match the api caller when called in delegated mode",
"innerError": {
"request-id": "87113028-5d7c-41e6-8a2b-918335117ec6",
"date": "2020-06-05T09:08:13"
}
}
}
The Graph API that I have used is below one and the user id that I am specifying is not mine while it is another user's and got the above error when I have logged-in using my account.
https://graph.microsoft.com/beta/users/{user-id}/chats/{chat-id}/messages
Can anybody please suggest how to resolve the above issue. I am using global admin credentials to post a message on behalf of a user.
I think using the below link if we perform authentication and tries to get access on behalf of the user then it is possible to do the same. Can anybody please confirm?
https://docs.microsoft.com/en-us/graph/auth-v2-user
Thanks in advance.