botframework-sdk: Bot authentication returns 401 following load testing instructions
Bot Info
- Bot handle: spjaebot
- App ID: 9c0072eb-f501-4042-af87-353a7dc8aee9
- SDK Platform: .NET
- SDK Version: Where do I check this from?
- Active Channels: Direct Line, Web, Telegram
- Deployment Environment: Azure website
Issue Description
I’m attempting to load test my bot using the instructions found here: https://blog.botframework.com/2017/06/19/load-testing-a-bot/ but keep getting a 401 when posting to my bot with the access token.
I attempted to generate an access token by POSTing to https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token with the following header values:
grant_type:client_credentials
client_id:9c0072eb-f501-4042-af87-353a7dc8aee9
client_secret:app_secret
scope:9c0072eb-f501-4042-af87-353a7dc8aee9/.default
The request returned the generated access token, but I’m unable to send anything to my bot’s URL. I’m sending a POST to https://mybotname.azurewebsites.net/api/messages with the following headers
Content-Type:application/json
Authorization:bearer mytoken
and a sample JSON payload as follows
{
"type": "message",
"id": "1234",
"channelId" : "test",
"conversation": { "id": "1122" },
"from": { "id": "user_id" },
"recipient": { "id": "spjaebot" },
"text":"hi",
"serviceUrl": "https://mytunnel.ngrok.io"
}
This results in a 401 with the error message of “BotAuthenticator failed to authenticate incoming request!”. However, I can test my bot through direct line, web chat, emulator (both local and remote) as well as telegram. I’m guessing I am doing something wrong with regards to authentication. I’ve set up a message sink using ngrok for load testing purposes. I don’t think it is an issue with the payload as the bot doesn’t even authenticate the request in the first place. I’ve also tried posting to /api/messages/v3 to no avail.
If any more information is needed I’m happy to send it over. Would appreciate any help 😃
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (12 by maintainers)
Hi @JasonSowers, no issues on my end now. Will reopen if need be.