Microsoft Teams OAuth credentials are expired after some time (around 1 hour)

Describe the issue/error/question

We are using Microsoft Teams node to post a message to the channel when a particular webhook is triggered.
Microsoft Teams OAuth credentials are successfully configured and the account is connected.
The message is successfully posted for some time (1 hour based on my considerations), but after some time the workflow throws an error.
Microsoft Teams account is still marked as connected:

What is the error message (if any)?

But the Team ID and Channel ID in node configuration are marked as error.
Clicking the button “reconnect” fixes the error for another hour or so.

Please share the workflow

Share the output returned by the last node

{
"body": {
"error": "invalid_client",
"error_description": "AADSTS7000215: Invalid client secret is provided. Trace ID: * Correlation ID: * Timestamp: 2022-01-20 13:18:04Z",
"error_codes": [
7000215
],
"timestamp": "2022-01-20 13:18:04Z",
"trace_id": "6f6ec321-b69d-4040-b733-55870270b800",
"correlation_id": "e35eeb0f-1b84-4ebd-b32c-597a2cac2cde",
"error_uri": "https://login.microsoftonline.com/error?code=7000215"
},
"code": "EAUTH"
}

However it is not possible that the incorrect secret is provided, as the credential worked before and after clicking the “Reconnect” button works like charm again.

Stack

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at Object.microsoftApiRequest (/usr/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Microsoft/Teams/GenericFunctions.js:23:15)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.execute (/usr/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Microsoft/Teams/MicrosoftTeams.node.js:234:44)
    at async /usr/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:47

Information on your n8n setup

  • n8n version: 0.159.1
  • Database you’re using SQLite:
  • Running n8n via npm (pm2):

Hm, I wanted to try this out but Microsoft isn’t even letting me log in to their website at the moment (I obviously didn’t try logging in repeatedly):

image

I wonder if there are some more general problems. Did this only start happening today?

1 Like

I created the workflow yesterday and it happens from yesterday.
Didn’t have an experience with the Teams integration before.
However, I can log successfully to Azure, Office and other related apps (so I don’t experience an issue like you do).

Still experience the same issue.
Anybody had similar problem maybe?

I am experiencing the same sort of problem. I am using a OAUTH2 account to access Sharepoint, and after some time (I’m not sure how long exactly) the account shows it’s connected fine, but then fails until I hit the reconnect button.

Hey @corey.mcmillan, welcome to the community!

I suspect that’s the HTTP Request node you’re using rather than any of the pre-built Microsoft-nodes in n8n?

How have you configured your credentials? Do you include the offline_access scope as described in Microsoft’s documentation?

@MutedJam That’s correct. It’s is for an HTTP Request node. I did not know about that scope. I will include that and see if it helps. Thanks!

1 Like

FYI, this scope only applies to Microsoft Graph API, there doesn’t seem to be an equivalent for the Sharepoint API. (https://companyName.sharepoint.com/_api/v2.0/) Looks like my answer is to try and get the data I need using Graph