Issue with Microsoft Teams resource authentication

  • Goal: To be able to send messages into a Microsoft Teams chat from a workflow

  • Steps/Details:

I created a resource and configured it like this:


As you can see it seems like it's authenticated/connected:

I'm using a query block in a workflow like this:
image
This seems to work for the next hours after I connect with OAuth in the resource. But after a while it gives me the following error and I'm forced to disconnect and reconnect again to refresh the access token:

How can I prevent the token from expiring? is that possible? if not, how could I refresh it programmatically?

Thanks

1 Like

I'm trying a workaround now.

I created a workflow in Teams that will expose a webhook and post a message in chat with the info received. This works in Postman. However when I try to run it in Retool I get a timeout error. The request is exactly the same.

Any idea why this happens? I'm stuck here...

Hi @Juan_Guerrero :wave: Thanks for writing in and including screenshots - super helpful!

I believe the reason for the original error related to the tokens expiring after a few hours is that it appears from your very first screenshot that you removed the offline_access scope which is prepopulated when you create a Microsoft Teams resource. Microsoft describes this scope as

The offline_access scope gives your app access to resources on behalf of the user for an extended time. On the consent page, this scope appears as the Maintain access to data you have given it access to permission.

[reference from microsoft.com]

Accordingly, it seems that since you removed the offline_access scope, we received only a short-lived access token and no refresh tokens, explaining why you were only able to use the connection for a few hours.

I recommend creating a new Microsoft Teams resource and including the offline_access scope.


I saw your follow up about a Teams webhook working from Postman but not Retool too. I'd suggest trying to get the built-in Microsoft Teams Resource working first.

Hope this helps!