APP ID/Passwords shared between tabs cause conversation to fail
Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.
Version
3.3
Describe the bug
The emulator seems to cache the AppId and password used to connect to a bot between tabs/conversations. If a bot is updated to remove / add the appsettings.json then the emulator needs to be restarted to pick up the change. Starting a new conversation tab or restarting the conversation fails as it uses the previous state. (Restarting the emulator is not the obvious choice when one encounters a exception in the bot)
To Reproduce
Steps to reproduce the behavior:
- Start a conversation with a bot running locally and using appsettings.json (and a valid appID and password specified in it). This conversation works fine.
- Stop the bot application, Delete the appsettings.json and restart the bot.
- The bot should now allow conversations where App ID and password are not specified.
- Do not close the emulator. "Open the bot" again and this time, only specify the endpoint and not App Id and Password.
- The new conversation will fail with an error and the bot debug window shows that the older App Id and password is still being passed in:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
System.UnauthorizedAccessException: Invalid AppId passed on token: <APP ID>
at Microsoft.Bot.Connector.Authentication.EmulatorValidation.AuthenticateEmulatorToken(String authHeader, ICredentialProvider credentials, IChannelProvider channelProvider, HttpClient httpClient, String channelId)
...
Expected behavior
If the emulator needs to be restarted to pick up new bot settings, then this should be made more obvious to users.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
[bug]
FWIW, we had several people run into this during our latest OpenHack in Los Angeles as well.
@cwhitten I'd still like to investigate this one as I believe I ran into this scenario on 4.5.x.
@drub0y do you recall if the people who ran into this were using 3.3 of the emulator or a 4.x version?