Access token error in flow when call Microsoft Teams Graph Spoke Post Message to Chat Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 12:15 PM
I have a requirement:
after the IT Service Help Desk starts a Teams Chat for a incident record, ServiceNow background should automatically send a message to the new created chat, sending more detailed incident information to the chat as shown in the image below.(Figure-1)
To meet this requirement, I created a Flow that calls the "Post message to Chat" action (Microsoft Teams Graph Spoke). In the Flow Designer's Connection Tab, I used one Microsoft Account to obtain a token for authentication in Microsoft Teams Graph Spoke and Microsoft Teams Spoke. (the validity period for Teams Spoke is only one hour).(Figure-2)
The result is that only when the incident caller is authentication user, be able to successfully run the flow after starting a Teams chat from the incident form/workspace, posting the message to the specific Chat Id. However, other users' incidents encounter the following error shown in Figure-3.
{"error":{"code":"InvalidAuthenticationToken","message":"Access token is empty.","innerError":{"date":"2024-03-06T19:07:05","request-id":"f2f9a60c-9fd7-4ab7-a5d7-d456888a0df5","client-request-id":"f2f9a60c-9fd7-4ab7-a5d7-d456888a0df5"}}}
Error: Access token is empty. Please Check Oauth Token and scope permission.
I'm not sure where the issue is. Could it be that my connection settings are incorrect, requiring the use of the login user to obtain a token each time? If so, how can I configure it to achieve it? Alternatively, could there be any restrictions on the "Post Message to Chat" Spoke Action?
Figure-1:
Figure-2 Connection Setting and Request Token
Figure-3 Flow Error in Post Message to Chat Action
Figure-4 permissions in Azure Portal
I referred to the following document:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 02:05 PM
Hello,
When you are setting up the credential information, make sure to add /oauth2/v2.0/authorize for Authorization URL and /oauth2/v2.0/token at the end of Token URL
example:
Authorization URL: https://login.microsoftonline.com/[your input]/oauth2/v2.0/authorize
Token URL: https://login.microsoftonline.com/[your input]/oauth2/v2.0/token
then click "Edit and Get OAuth Token".
Hopefully that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 01:56 AM
To resolve the issue, try the following: Check the expiration date of your token and renew it if necessary. Make sure your connection settings are correct and meet Microsoft Teams Graph requirements. Review the Send Chat Message action limits and make sure your request meets those limits. If the problem persists after doing this, please refer to the Microsoft Teams Graph documentation or contact support for further assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 08:48 AM
Did you ever resolve this problem? I've got the same issue and I'm drawing a blank on how to fix it.
Anything you can offer would be appreciated.
Cheers!