title: Custom Bot for Microsoft Teams getting "BotAuthenticator failed to authenticate incoming request!" error
body: <p>I am making a custom bot, using the Bot Framework, for Microsoft teams. I am currently hosting the bot locally and tunneling through ngrok, and I'm using the /api/messages URL. I have registered the bot with the bot framework, and put the bot handle in BotId, app ID in MiscrosoftAppId, and app password in MicrosoftAppPassword in my Web.config. The Teams channel is enabled and has status "Running" on the Bot Framework page. The bot runs on the emulator, and runs on the test connection on the Bot Framework page, but it does not run in Microsoft Teams.</p>
  
  <p>This is what is being sent to my bot:</p>
  
  <pre><code>"type": "message",
  "id": "1497620296742",
  "timestamp": "2017-06-16T13:38:19.303Z",
  "localTimestamp": null,
  "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/",
  "channelId": "msteams",
  "from": {
      "id": "29:1F9b3IgxC3x5ynp7nVxdSQ0bQ9MNyf7uKDZHrrCfRLyBbjOmdWSY4gyFLuR8cTRFmbXOeDN4f_uI65xSem6M5OA",
      "name": "Ronnei, Evan T"
  },
  "conversation": {
      "isGroup": true,
      "id": "19:d02a9a4678924803964e6af1d9afc1ab@thread.skype;messageid=1497558943513",
      "name": null
  },
  "recipient": null,
  "textFormat": "plain",
  "attachmentLayout": null,
  "membersAdded": null,
  "membersRemoved": null,
  "topicName": null,
  "historyDisclosed": null,
  "locale": null,
  "text": "Test Bot",
  "summary": null,
  "attachments": [
      {
          "contentType": "text/html",
          "contentUrl": null,
          "content": "&lt;div&gt;&lt;span itemscope=\"\" itemtype=\"http://schema.skype.com/Mention\" itemid=\"0\"&gt;Test Bot&lt;/span&gt;&lt;/div&gt;",
          "name": null,
          "thumbnailUrl": null
      }
  ],
  "entities": [
      {
          "type": "clientInfo",
          "locale": "en-US",
          "country": "US",
          "platform": "Windows"
      }
  ],
  "channelData": {
      "teamsChannelId": "19:d02a9a4678924803964e6af1d9afc1ab@thread.skype",
      "teamsTeamId": "19:e218343840af4d4397faf47bd3f4eada@thread.skype",
      "channel": {
          "id": "19:d02a9a4678924803964e6af1d9afc1ab@thread.skype"
      },
      "team": {
          "id": "19:e218343840af4d4397faf47bd3f4eada@thread.skype"
      },
      "tenant": {
          "id": "a9691d3f-49e3-46a8-8b23-ddad274d0523"
      }
  },
  "action": null,
  "replyToId": null,
  "value": null,
  "name": null,
  "relatesTo": null
  </code></pre>
  
  <p>And it's giving me this 401 Unauthorized error:</p>
  
  <pre><code>BotAuthenticator failed to authenticate incoming request!
  </code></pre>
  
  <p>I'm very much a beginner when it comes to all of this stuff. I followed the available tutorials on the Bot Framework documentation, but it still doesn't work on Teams. I'm sort of stuck at this point. Let me know if there's any more information that I should provide.</p>
  
  <p>Apparently I don't have enough reputation to post more code... So here's my manifest.json: <a href="https://pastebin.com/xK7y2VHX" rel="nofollow noreferrer">https://pastebin.com/xK7y2VHX</a></p>