-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while trying to use JwtTokenValidation.authenticate_request #2114
Comments
@Loprock That error indicates the token the bot received does not contain the correct audience claim. The expectation is that the audience claim matches the bots AppId. Is 4.11.0 correct? That was released in Nov 2020. If accurate, this is ually because the config for the bot is wrong. |
The config was correct.. i verified it multiple times. but the issue persists |
As a start, I would recommend updating to the latest released version, and review what changed around March. But if you've been using this bot without changes, and it started happening in March, this would lead to some other change outside the bot happening. |
Tried doing it on multiple bots, each with a different AppId, getting the same error every time, with the new AppId in the logs. |
The exact cause is the 'aud' claim in the token the bot received doesn't match the bots appId in config. This is part of token validation. If your bot hasn't changed then this is a config issue elsewhere. Did your Azure resources change? If you run the bot in debug, and break in your app.py, 'messages' function. Take the token in the 'Authorization' header and decode it (search for 'JWT token decoder'). You'll be able to see what 'aud' claim is being sent. |
I actually run the bot from within a script that runs on a VM I use (as part of a bigger product), when I do that I can't really break the code in that exact spot since it's a production environment so I can only throw logs outside while it's active. |
You could log it. I would recommend removing that log message when done though. |
Actually... the error message should have the appId it received in it. |
The AppID I got matches exactly to the one I have in my Azure app and the same one I set over the .conf file over the machine |
@tracyboehrer I also saw this thread, which was magically solved one day, I think the issue isn't on my end, is it possible that it's on Microsoft's end? |
Hi @Loprock I can see you're using version 4.11 where single-tenant Azure Bots are not compatible, only multi-tenant are. I have faced a similar issue in the past where I was trying to configure my BotFramework Python SDK with single-tenant. While creating the bot you need to select multi-tenant as shown in image To verify this issue you can import this curl request into POSTMAN and test it with your Azure Bot APP_ID and APP_PASSWORD. curl --location 'https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token' If you're not able to generate an access token using your credentials, your Azure Bot is probably not configured properly. You can always change your bot from single-tenant to multi-tenant if that's the underlying issue. |
Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.
Version
botbuilder-schema==4.11.0
botframework-connector==4.11.0
Describe the bug
Using python.
After using the following request 'JwtTokenValidation.authenticate_request' we started getting the error:
[Errno Unauthorized. Invalid AppId passed on token: ] b*******-4***-4***-8***-a***********
this issue started occurring from ~March 2024
To Reproduce
Steps to reproduce the behavior:
the whole flow is represented in the code snippet. after the main init we try to setup a webhook which is failing
Expected behavior
we want the auth to get approved and manage to communicate
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
adding a code snippet to show the flow (only relevant for this issue)
The text was updated successfully, but these errors were encountered: