Bug in MS Teams Credential Refreshing

Describe the problem/error/question

I am getting intermittent issues causing failures in my MS Teams AI Agent. The issue appears to stem from the process to refresh the access token from the refresh token for the Microsoft Teams OAuth2 API credential type.

We have an AI Agent that will be working fine, responding, making API requests out to teams, all great. Then out of nowhere, and without making changes, it will suddenly start failing with 403 errors, often with a message saying “No authentication information was provided.”

Shortly later, if we continue messaging the bot (and triggering workflows), it will miraculously recover and start working again. Again we don’t do anything. We just chat with the bot, it works, it stops working, and later starts working again. All because of the teams credentials. The self healing is nice but the fact that it fails in the first place is very alarming. Most employees now consider the bot unreliable and don’t engage with it.

I have also observed another failure mode, where we seem to no longer receive any webhook requests from MS Teams, even though the credentials themselves are fine and workflows run correctly when triggered manually. In these cases, sometimes deactivating and reactivating the workflow fixes the problem. In other cases, the problem persists and sometimes 30 minutes or an hour later, the webhook comes back to life without me doing anything, and old events from Microsoft suddenly start getting processed.

Information on your n8n setup

  • n8n version: Version 1.122.5
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default, not set in config
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker container
  • Operating system: Host VM is Linux cassprn8n01.well.local 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux. Docker container is official from n8n.
1 Like

oof yeah the MS Teams OAuth refresh has been buggy for a while. the 403 → self healing pattern you’re seeing is classic token refresh race condition - n8n’s retry logic eventually succeeds but not on first attempt.

few things to try:

1. recreate the credential from scratch (sometimes the stored refresh token gets corrupted)

2. make sure your Azure app has `offline_access` scope - without it the refresh token can behave weirdly

3. check if you’re hitting rate limits on the token endpoint (less likely but possible with high volume)

for the webhook death issue - that’s usually MS Teams unsubscribing your webhook when it gets too many failures. when the credential is flaky, webhooks fail, teams kills the subscription, then n8n re-registers it on next activation.

not a real fix but you could add error handling with a Wait node + retry loop to mask the token refresh failures until this gets patched. also worth checking if you’re on the latest version since oauth handling has had several fixes recently (you’re on 1.122.5, current is past 1.70+).

lmk if recreating the cred helps or if you need the retry pattern setup