1
votes

I am trying to connect my local webchat client to my local bot but it's throwing a 403. I tried adding localhost:3000 (port for my webchat) as a trusted origin but it still doesn't help. However, it works just fine if I use the emulator or postman (the token generation part to connect via Directline)

Here's everything I did:

  • Started my local bot and used ngrok to map it to an internet address.
  • Changed the messaging endpoint to https://xxxxx.ngrok.io/api/messages
  • Configured a directline channel, took the secret key and used it in my react webchat client (running on port 3000) to establish directline connection using createDirectLine from botframework-webchat and passing a token. I am hitting to this API in this format:
POST https://directline.botframework.com/v3/directline/tokens/generate
Authorization: Bearer SECRET

After this point the console throws an error 403 and doesn't allow me to proceed further. However, I am able to generate the token through postman and the same ngrok URL works great with the bot framework emulator.

Please help me understand what I am doing wrong. I spent a good part of my day researching on getting till this step and would really appreciate an input from the experts.

Thank you.

1

1 Answers

1
votes

works great with the bot framework emulator

When you are testing with Emulator, are you using a username/password, or is it blank? Make sure the MicrosoftAppID and MicrosoftAppPassword are configured in the bot when running locally and you are using NGROK to go through channels.