Search code examples
.netbotframeworkmicrosoft-teams

Microsoft Teams Bot - debug refresh token flow


While development of a Microsoft Teams Bot I faced a problem that refresh token endpoint is never called. I believe it's my mistake in configurations but I can't find any details what exactly is going wrong. What I did:

  1. Set Token Exchange URL in bot settings on Azure side
  2. Set scopes to email offline_access
  3. Checked that refresh_token was issued: I see that code was issues:
{
  "code": "[removed for security reasons]",
  "grant_type": "authorization_code",
  "redirect_uri": "https://token.botframework.com/.auth/web/redirect",
  "client_id": "microsoft-teams-bot",
  "client_secret": "[removed for security reasons]"
}

and after that refresh_token was issued by the code:

{
  "scope": "email offline_access",
  "token_type": "Bearer",
  "access_token": "[removed for security reasons]",
  "expires_in": 3600,
  "refresh_token": "[removed for security reasons]"
}

but refresh_token is never used after that.

Any ideas what might be wrong?


Solution

  • The problem was wrong configuration for the bot. It's using Refresh endpoint to get access token by refresh token (but I though it's using exchange endpoint).