Hello Community Members,
I hope you’re all doing well! I’ve been using Microsoft Copilot Studio to build and deploy my chatbot on our custom website app. However, I’ve encountered an issue related to web channel security.
Here are the details of the problem:
- Issue: Web channel security is not functioning as expected. It works sometimes and not others.
- Scenario: I want to restrict access to my bot using the secret and tokens. but I often get a 403 Forbitten error when fetching the token. we tested different bots with the following dummy implementation (note we will do all the server site security configuration just did it this way for testing:
var chatWindow = document.getElementById('chatWindow');
var secret ='secret put here';
fetch('https://directline.botframework.com/v3/directline/tokens/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + secret
}
})
.then(response => response.json())
.then(data => {
var chatWindow = document.getElementById('chatWindow');
chatWindow.src='https://copilotstudio.microsoft.com/XXXXXXXXXXXXXXXXXXXXXXXXXXXX&token=' + data.token;
})
.catch(error => console.error('Error:', error));
- Desired Outcome: I’d like to ensure that only authenticated requests can interact with my bot via the web channel and that the bot can retrieve and pass on the tokens.
Questions:
- Has anyone been able to use the Direct Line API 3.0?
- Are there any additional steps I need to take to enforce web channel security effectively?