Tried code from Microsoft.Bot.Sample.AadV2Bot but even locally get AADSTS50011 (reply url doesn't match) - botframework

I've integrated the Code from Microsoft.Bot.Sample.AadV2Bot in my own bot but the GetTokenDialog call always results in error "AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application: 'MYBOTSAPPID'"
As far as I understood, I do not have to register my bot in Azure Portal under "Azure Active Directory" but setup the Reply URL in the application registration Portal (https://apps.dev.microsoft.com) - Correct?
But whatever values I enter here, it won't work, neither locally via Emulator nor via Web. Furthermore, in MS Teams the signin Dialog does not work at all.
I've already tried these reply URLs without success:
https://MYBOTSNAME.azurewebsites.net, http://localhost:3978 and https://localhost:44362
I also tried to extend these with /api/messages, /signin-oidc and several other combinations, all without success.
The mentioned sample solution also does not include more keys than ConnectionName, MicrosoftAppId and MicrosoftAppPassword in web.config, so I haven't got a clue which redirect URI is taken on runtime.
In Azure Portal I've created an Azure Active Directory V2 Connection on my bot and entered my bot's Microsoft App ID in the field "Client ID" and Microsoft App Password in the field "Client Secret" - is this correct?
Any hint what I might have done wrong is VERY welcome!!

I finally could solve the Reply URL mismatch problem myself. Had to enter this Reply URL on my app in the application Registration Portal to make it work locally, via Emulator:
https://token.botframework.com/.auth/web/redirect
Still, the authentification Dialog (GetTokenDialog class from Microsoft.Bot.Builder.Dialogs) doesn't popup when I use MS Teams as channel.
Does anyone have an idea what could help?

Related

"Cannot post activity. Unauthorized" When testing from Bot Emulator

While testing the EchoBot template from Azure in Bot Emulator I keep getting "Cannot post activity. Unauthorized." How can I protect against this? I am new to .NET, so don't understand the how authentication is working here. I can see the configuration settings being loaded, but I don't see how they get supplied or applied in the default EchoBot template from Azure.
I have found I only get Unauthorized, if I have the "MicrosoftAppID" and "MicrosoftAppPassword" defined in the appsettings.json. If I comment these out it works fine.
[HttpPost]
public async Task PostAsync()
{
// Delegate the processing of the HTTP POST to the adapter.
// The adapter will invoke the bot.
await Adapter.ProcessAsync(Request, Response, Bot);
}
So I would like to understand how to avoid having to comment these lines out when testing the code locally. PostAsync returns the 401.
Have you tried adding your Microsoft App ID and Microsoft App Password inside of the Emulator ?
It should work fine after you add those when you test the bot in the emulator, check picture below
Go to your appSettings.json file and check if you have provided Microsoft App ID and App Password. You will get it when you have registered your app on Azure. If you haven't register it on Azure, you won't get ID and password. In this case, you must left the Microsoft App Id and Password json string as blank. Something like this:
In the Bot Emulator, don't give any credentials. Just provide your app URL and click Connect.
By this way you can get rid of the error.
Hope this helps.

Dynamics crm tenant url doesn't work as adal reply url

I have integrated adal.js in my Dynamics crm custom solution to embed power bi report which works fine but since redirect url need to be set on azure portal app registration so set my tenant url like:
https://myurl.crm6.dynamics.com
but I am getting message like :
"The reply url specified in the request does not match the reply urls configured for the application"
My custom dashboard has been set as default dashboard on tenant. And this custom dashboard contains adal.js and other related js code.
Any suggestion would be appreciated.
The reply url in your tenant needs to exactly match whatever you have set as your reply URL in your app settings/web.config in your code. Have you ensured that these are matching?

Azure Bot Service Error Message

I am having a problem trying to create a Microsoft App ID and password for my Bot. After creating a bot on Bot Service on the Azure portal I try to create a Microsoft App ID.
When I click the Create Microsoft App ID and password button as shown on the image above, it opens a new tab and I get this error message:
I'm also having problems with a previously created bot. When I go to All Resources on the Azure portal and click on that previously created bot I get the following error message:
Unable to find the specified id
I thank you in advance for your time and help :)
I definitely saw this happening on some MSA accounts, it's not a Bot Framework or Azure Bot Service issue. Two things you might try:
try creating MSA AppId and Password directly from https://apps.dev.microsoft.com/
If this doesn't work, do you have another MSA account you could try with?
Hope this helps
Andrea
I've seen this error before. Retrying fixed the issue for me (click Create Microsoft App ID and password button again). Please try again. You might need to sign out, clear your cookies, and sign back in.

Bot Service Basic Bot not responding to prompts

I've a Basic Bot Template based Bot set up using Bot Service. I've built a use case with few question prompts and capturing answers. I see the timestamp below my prompt in the chat box indicating that my prompt is delivered. But don't get a response back from the service. The application is still in develop and still haven't published it.
On Channels -> Web Chat -> I see few errors being logged.
Error: "There was an error sending this message to your bot: HTTP status code NotFound".
Could anybody help resolving this error?
A 404 (Not Found) would imply there's something wrong with your bot's registration in the bot framework portal. Can you log into dev.botframework.com, open your bot, hit edit, and see what the endpoint URL looks like?

Microsoft Bot Web Chat Not working but Emulator work fine

I have created a bot application and published it to azure. When I test this bot using Emulator it works fine but when I use the web chat control it doesn't show anything . I am using the correct app-secret .
The link to web chat is here . My bot is hosted on azure .Here is the link of Message Endpoint= https://bingsearchandemotionbotv3.azurewebsites.net/api/messages
The first thing to check: If you go into your bot management page on https://dev.botframework.com/bots and press the blue "Test" button on the bottom left ("Test connection to your bot"), does it indicate that the bot accepts the connection by the bot framework middleware?
If not, then there might be something wrong with your bot. It will actually give you some indications. If it's "forbidden", then you might have a problem with authentication (check your appId and appPassword). If it's an error, then your bot might have a code issue / exception.
If the connection has been accepted, check if your web chat credentials have been validated. To do so, click on the "Edit" link next to the Web Chat channel on the bot management page. Try regenerating your credentials and (most importantly) make sure you checked "Enable this bot on Web Chat" and confirm.

Resources