microsoft/BotBuilder-Samples

PermissionError(Invalid AppId passed on token) when deploying echo-bot to Azure app service

Closed this issue · 1 comments

Github issues for C# /JS / Java/ Python should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Sample information

  1. Sample type: python/02.echo-bot
  2. Sample language: python
  3. Sample name: echo-bot

Describe the bug

I try to deploy the echo-bot sample to Azure. I created app service, app service plan and azure bot resources. Then I deploy the bot and tried to interact with it. However I got an error:
2023-10-18T09:19:55.129647740Z PermissionError: [Errno Unauthorized. Invalid AppId passed on token: ] efcfa6cb-c88a-4a2d-a3a1-2e988abf9554
'efcfa6cb-c88a-4a2d-a3a1-2e988abf9554' is the "aud" (audience) claim identifies the recipients that the JWT is intended for, decoded from the auth token. It is exactly the same as my azure bot id, while the validation func said they are different:

image

To Reproduce

Steps to reproduce the behavior:

  1. Git clone my sample repo: https://github.com/frankqianms/echo-bot (the main logic is the same as the sample in BotBuilder-Samples, I just added some files to make it can be handled by Teams Toolkit)
  2. Install Teams Toolkit in VS Code and open the repo folder in VS Code
  3. Click the provision button in Teams Toolkit
  4. After 'provision', go to Azure portal, find your app service, and change the "startup command" as the following: pip install -r requirements.txt && gunicorn app:app
  5. Click 'deploy' button in Teams Toolkit
  6. Choose 'Launch Remote in Teams (Edge)' to start debugging
  7. After send a message to the bot in Teams channel, go to app service log stream to check the log. Then you'll see the error

Expected behavior

Give a clear and concise description of what you expected to happen.

Screenshots

image

Additional context

Add any other context about the problem here.

The issue was resolved. The main reason of this issue is that the name of 'botid' and 'botpassword' in config settings defined in bicep do not match those in config.py.
Thanks~