![](/img/trans.png)
[英]Bot FrameWork IE Issue using ReactJS and NodeJS web APP
[英]Bot FrameWork Edge 40.15063.674.0 Issue using ReactJS and NodeJS web APP
嗨,我在Azure Web应用程序中使用了Nodejs和reactjs的机器人框架实现。 该代码在Edge(Microsoft Edge 44.17763.1.0),Chrome和IE中运行正常,我收到Edge 40.15063.674.0边缘版本附带的错误。 此应用程序已通过AAD身份验证,因此我们能够提取已登录的用户。
下面是我们收到的错误消息
SEC7120:在Access-Control-Allow-Origin标头中找不到原始https://botsite.azurewebsites.net 。
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Web Chat: Full-featured bundle with ES5 polyfills</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
This CDN points to the latest official release of Web Chat. If you need to test against Web Chat's latest bits, please refer to pointing to Web Chat's MyGet feed:
https://github.com/microsoft/BotFramework-WebChat#how-to-test-with-web-chats-latest-bits
-->
<script src="webchat-es5.js"></script>
<style>
html, body {
height: 100%
}
body {
margin: 0
}
#webchat {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
const settings = {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Access-Control-Request-Headers': 'X-Requested-With',
'Access-Control-Allow-Origin': 'https://agnappprodsmartassistance.azurewebsites.net',
'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
}
};
var loginID = '';
window.fetch('/.auth/me', settings).then(function (response) { return response.json() }).then(function (responseData) {
loginID = responseData[0].user_id;
responseFromAuthCall = encodeURIComponent(responseFromAuthCall);
}).then(function (test) {
window.fetch('https://directline.botframework.com/v3/directline/tokens/generate', {
method: 'POST', headers: {
'Authorization': 'Bearer 8rV5oplNFL0.cwA.N9c.dQi5utdOwX8-qH_9Nh4a1DzRxGRRFAV64n7P5mgiyAM',
'Accept': 'application/json',
'Content-Type': 'application/json',
'Access-Control-Request-Headers': 'X-Requested-With',
},
body: JSON.stringify({
accessLevel: 'View',
allowSaveAs: 'false',
})
})
.then(function (res) {
return res.json();
})
.then(function (json) {
const token = json.token;
var dl = window.WebChat.createDirectLine({ token: token })
window.WebChat.renderWebChat({
userID: loginID,
directLine: dl,
}, document.getElementById('webchat'));
document.querySelector('#webchat > *').focus();
});
});
</script>
</body>
</html
Web聊天仅支持Edge的最后两个版本(v42 <)。 https://github.com/microsoft/BotFramework-WebChat#browser-compatibility
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.