I'm developing a chat bot using MS bot framework v4 SDK in C#.
I've chosen Dispatch bot sample as my base, Since I'm using QnA maker and Luis. Now i want to add an authentication to access my bot. As per the sample Authentication Bot I've added all the dependency including the nuget packages, methods and classes in my bot project code, but still the authentication is not working for me, it throws an exception error and gives sorry something went wrong error. There could be some issue with the way of integration and calling the correct methods.
if anyone has solution or sample of a bot with both authentication and QnA Maker used, please do share me

Sandhiya PriyaPosted Oct 27, 2025, 9:10 AM
you’re trying to integrate Azure AD authentication (like OAuthPrompt or Bot authentication) into a Bot Framework v4 C# Dispatch Bot that already uses LUIS + QnA Maker. You’ve added the dependencies from the Authentication Bot sample, but it’s still failing with the “Sorry, something went wrong” message — usually meaning a misconfiguration in your OAuth connection, app settings, or adapter setup.
Let’s break this down carefully
Common Integration Steps (Authentication + LUIS + QnA)
Here’s the correct and stable integration pattern for your scenario.
1. Ensure all required NuGet packages are installed
Make sure your
.csprojincludes:For authentication:
2. Create an OAuth connection in Azure Bot Channels Registration
Go to your bot in Azure Portal ? Settings ? OAuth connections.
Add a connection (e.g.,
MyBotOAuthConnection) with:Service Provider: Azure Active Directory v2
Client ID / Secret / Tenant ID: from your Azure AD App Registration
Scopes:
User.ReadNote the Connection Name — it must match exactly what you configure in your bot.
3. Update
appsettings.json4. Update your
Startup.csMake sure your adapter and BotFrameworkHttpAdapter handle authentication errors properly.
Then in
Startup.cs:5. Add Authentication Dialog to your Bot
Create
LoginDialog.cs:6. Integrate with your Dispatch Bot
In your
DispatchBot.cs, inside theOnMessageActivityAsyncmethod:7. Debugging the “Sorry, something went wrong” Error
Check these common points:
Working Example Reference
Here’s a working sample from Microsoft combining QnA + LUIS + Auth:
?? GitHub: BotBuilder-Samples — 51.csharp.AdaptiveBotWithLuisQnAAuth
That example shows exactly how to integrate QnA, LUIS, and Azure AD authentication into one bot.