Bot frame v3 unauthorized

I am trying to use MS botframework V3 to create a base bot using the nodejs tutorial code, but I continue to get 401 Unauthorized using an emulator. Please, help?

AppId / Secret are set in env variables and are definitely correct in the emulator.

Code below

var restify = require('restify'); var builder = require('botbuilder'); //========================================================= // Bot Setup //========================================================= // Setup Restify Server var server = restify.createServer(); server.listen(process.env.port || process.env.PORT || 3978, function () { console.log('%s listening to %s', server.name, server.url); }); // Create chat bot var connector = new builder.ChatConnector({ appId: process.env.MICROSOFT_APP_ID, appPassword: process.env.MICROSOFT_APP_PASSWORD }); var bot = new builder.UniversalBot(connector); server.post('/api/messages', connector.listen()); //========================================================= // Bots Dialogs //========================================================= bot.dialog('/', function (session) { session.send("Hello World"); }); 
+6
source share
3 answers

try changing appId and appSecret to MicrosoftAppId and MicrosoftAppPassword respectively.

As indicated on the bootframe website

In V1, authentication properties were saved using these keys:

  • Appid
  • Appsecret

In V3, to reflect changes in the underlying auth model, these keys were changed to:

  • MicrosoftAppId
  • MicrosoftAppPassword

Edit: So, from Steven's github post, the actual values

  • appId

  • appPassword

    These values ​​will not work with the emulator due to a problem with node sdk, however they should work during deployment.

Link: https://github.com/Microsoft/BotBuilder/issues/625

+6
source

When using the emulator for the first time, I added the application and password myself. I found out that not a single application identifier and password work fine in local mode.

: Removing the application and password in the web.config file in the bot application and in the emulator resolved my error. Hope it helps. Hooray!

+1
source

I have the same problem, but I can get this solution to work. It looks like you can specify any values ​​for id and pw. If they are not found, is authorization disabled? It's right? I tried this

 var connector = new builder.ChatConnector({appId:'999', appPassword: 'xxxx'}); 

And I'm still getting 401.

0
source

All Articles