我正在尝试通过 javascript (ReactJS) 向 Wit.ai 发出 API 请求。我的浏览器网络选项卡显示呼叫失败并显示以下消息:
“错误”:“错误的身份验证,检查令牌/参数”
但是,同一调用在 Wit.ai 日志中显示为成功。我已验证凭据正确,并且可以通过终端成功 cUrl 通话。
这是电话:
async action() {
const resp = await fetch('https://api.wit.ai/message?v=20160526&q=hello', {
method: 'GET',
headers: {
'Authorization': "Bearer " + accessToken
},
dataType: 'jsonp',
mode: 'no-cors',
credentials: 'include'
}).then(resp => resp.json()).catch(e => console.log('Boo', e));
}