Bot Framework always getting unauthorized response - botframework

I started using Microsoft Bot Framework and followed step by step all tutorials.
I has been able to register a new bot and to deploy it working good with emulator, but except it nothing else works.
Test connection to your bot chat do not works despite I get answer from emulator and from all connected channels, that where created and registered properly I always get an Unauthorized response or something like that, anyway no response, so nothing works.
I tried with Twilio, Web Chat, Telegram (Skype auth is pending) getting always the same response.
As it seems I strictly followed the tutorials, is there something else to do or to be approved? Or just the service is still not working at 100% as too young?
Thanks

If you are using HTTP you need to disable basic auth because the connector won't send your appSecret in the clear.
The solution is to make sure you register as HTTPS, or if you need to use HTTP then disable the basic auth.

Took me a while to get it working locally too. Oddly for me it only works when those 'secret' fields are empty, as mentioned and running in debug.
Running without debugging seems to always result in a 401

Hi I was facing same problem to work bot locally in v3. I just made everything blank in web.config and it is working.

I solved the problem.
It was related to https. It's not well explained into tutorial but when you create and publish a service in Azure it is created as http://XXXXXXX.azurewebsites.net as shocased into tutorial, but it will not work as your service must run in https.
I so used https://startssl.com to create a free ssl certificate then turned on SSL into my Azure service so everything started working.

I've cleaned up the getting started with the following; hopefully it will make it clearer for the next person who uses it:
Click the “Register a Bot” button and fill out the form. Many of the fields on this form can be changed later. Use a the endpoint generated from your Azure deployment, and don’t forget that when using the Bot Application template you’ll need to extend the URL you pasted in with the path to the endpoint at /API/Messages. You should also prefix your URL with HTTPS instead of HTTP; Azure will take care of providing HTTPS support on your bot. Save your changes by hitting “Create” at the bottom of the form.

Make sure you are using HTTPS. BotFramework will not work with basic auth so tokens are not passed in the clear.
See: http://docs.botframework.com/connector/calling-api/

Make sure that you republish your bot service after registering and getting the app Id and password. If you fail to do this you will get Unauthorized. The steps are 100% clear on this and I hit this for a minute.

Related

Whatsapp webhook won't connect with ngrok

I made a controller in laravel for WhatsApp webhook authentication, run it locally and use ngrok to connect it with WhatsApp webhook, it won't connect, it said "The Callback url or verify token could not be validated", but when I deploy it on heroku it working normally.
Is there any special config so I can connect it locally using ngrok ? or is there any alternative solution?
Went through the same issue and it seems that WhatsApp Cloud API considers NgRok malicious, and won't accept it as a callback webhook endpoint.
You need to follow the steps provided in ngrok documentation,
https://ngrok.com/docs/integrations/whatsapp/webhooks,
I am not sure which step you are missing or have a problem with, but as per the error "The Callback url or verify token could not be validated", your deployed code for webhook is not valid as per the provided guideline in WhatsApp webhook docs.
Make sure you have set the same verification code in the code and webhook verification when you configure!
According to the ngrok docs, you need to have a pro or enterprise license for validation to work. A free alternate solution for anyone that may need it (at least at the time of writing) is Cloudflare tunnel. Just read the docs or you can watch this video(CLI version) or video(dashboard version) to help you set it up. You will need to have a domain though.

Getting errors after adding the Bot in Teams

I'm getting errors after adding the BOT in teams. I have created a simple Hello default bot using the MS Teams Toolkit and Vs Code. The best part is whenever i'm creating any BOT and try to run it in Bot emulator then it is working fine which is on localhostwith 200 ok response but not in teams either i'm getting 404 or 500 in POST requests.
Can someone please help and through some light and tell me what i'm doing wrong here or what could be the possible cause of the errors.
ng-rok error log
Your bot looks like it's configured to reach your ngrok environment properly, so that's good, but it looks like the path is incomplete. You need to tell the Bot Framework the full path to the actual running endpoint in your app - it's usually something like https://[something].ngrok.io/api/messages, like the below screenshot:
Under the "messaging endpoint" section, see the full path. I suspect you only have the https://[something].ngrok.io part and not the /api/messages part.
You can see this because in your ngrok log that you've posted, the path is direct to the root (/), not to /api/messages or similar.

Skype for Business channel doesn't pass authentication credentials correctly

I have a .NET Bot Framework bot created using the template and tested on other channels and in the dashboard.
I've added the Skype for Business channel and performed the PowerShell cmdlets for my tenant. However, I constantly get the reply "Error happened in contacting target user".
I looked in the Bot Framework Dashboard for issues, and the problem is that the Bot Framework is getting back a 401 Unauthorized from my code. Remember that this works fine in other channels.
Suspecting a problem with how Skype for Business passes (or doesn't pass) the authentication tokens I commented out the BotAuthentication decorator. Suddenly everything works fine. So I think there's a problem with the Skype for Business channel and how it passes the authentication credentials, as this situation clearly isn't ideal.
Just to answer my own question on this. The reason I was seeing this problem was because I did not have the latest version of Microsoft.Bot.Builder. I needed to be running 3.5+ and I wasn't. I've written it up here (along with instructions for updating the NuGet package if you need that): https://blog.thoughtstuff.co.uk/2017/06/how-to-enable-your-bot-framework-bot-on-skype-for-business-part-2-or-how-i-followed-the-instructions-and-it-worked/

Youtube API v3 shows "Access Not Configured"

I created a Google application in the developers console, turned on "YouTube Data API v3", generated the server API key, and authorized my home and work IPs.
My website lists all videos from a Youtube channel, using the V3 API. It uses the official PHP library, passing it the server API key.
It all worked well yesterday from home, and today morning from work. Then, it suddently stoped working at 11am (GMT+1), with no action from my part, with this error:
[Google_Service_Exception] Error calling GET
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=xxxxxxxxxx&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
(403) Access Not Configured. The API is not enabled for your project,
or there is a per-IP or per-Referer restriction configured on your
APIkey and the request does not match these restrictions. Please use
the Google Developers Console to update your configuration.
Note: i used less than 10 requests, out of the 50 millions allowed by day, i have a static public IP address, this part of the code was untouched.
What can i look for in order to fix that, please? I really don't know where to head for from now... Thank you.
Oooook...
Do all you have to with the API activations before you generate any keys!
Unactivating or reactivating API (like "Youtube Data") silently destroys your key validity. At least for the server one.
So the solution is, when you get the same error as me:
destroy your server key (delete it completely, do not only regenerate)
deactivate then reactivate all APIs you need
create a new server key
thank Google for the so clear error messages (optional)
Additionnaly when I opened the requested URL in browser I found that the API call returned
{"domain": "usageLimits"}
I tried the above solutions without success.
Creating a new project from scratch solved the issue
Thanks #Danra, you helped, but I add this answer because your comment is default hidden.
This solved for me....
i first followed #Ninj answer...still no change.
Then, After adding my domain urls to 'allowed referers' list,
i regenerated the key alone
it then worked like a charm !
i guess google parses allowed urls from the key string itself, not from updated settings
I got frustrated and created a new project with a new key and it worked like a charm.
Solution 1:
Create new project and enable Youtube Data v3 api and create credential.
Solution 2:
Check limit Quota in Youtube Data v3 -> Quota (in left pane) &
Increase the limits per day or request for Higher Quota
I also tried everything, but could only solve this when I created a new project, gave access to the APIs I needed, and added a new key.
I also got a "Bad Request" error and this solved it.
I also tried everything, but could only solve this when I created a new project, gave access to the APIs I needed, and added a new key.

Posting an entry from IBM Social Business Toolkit playground to on premises Connections

I am trying to post entry to community activity stream from IBM Social Business toolkit playground (Domino 9, SBT SDK version 20130602) to on premises Connections install. I am using the playground's existing JavaScript snippets but changed the communityID to match to community UUID in my Connections install. I don't have the OAuth2 configured.
I get an error "Error code:403, message:You are not authorized to perform the requested action."
I am able to get data from Connections. For example "Get Updates From A Community" -snippet works. But I am not able to post anything to Connections.
Do I need a working OAuth2 to be able to post entries or is there something else what prevents posting entries to Connections activity streams?
I tried to add a role to my account according to this post Which J2EE Role need to be enabled to post in the Activity Stream of other user but it did not seem to have an effect.
I was able to get the post entry working. The issue seems to be the browser what I used.
Posting entry did not work with Chrome but with Firefox everything worked as expected. So there seems to be some problems with Chrome and posting entries from the playground. Getting data from Connections works also with Chrome.
Are you prompted for basic authentication (either basic auth or OAuth would would work)? Or are you just accessing public communities?
Can you try to go to the authentication snippets, log in if not already (basic auth),and try the snippet again? If you still have a 403, it might be because your user doesn't have enough rights.

Resources