简体   繁体   English

Twilio taskRouter js sdk 给出 CORS 错误

[英]Twilio taskRouter js sdk giving CORS error

Tried doing a worker.update(...), worker.completeTask(...) and always getting a CORS error from localhost.尝试执行 worker.update(...)、worker.completeTask(...) 并始终从 localhost 收到 CORS 错误。

在此处输入图像描述

Try adding this Policy to your back end.尝试将此策略添加到您的后端。 There is apparently a "bug" in the example code that Twilio provides and it has yet to be fixed. Twilio 提供的示例代码中显然存在一个“错误”,并且尚未修复。

This code is assuming a Node backend but the equivalent should work in any language此代码假设一个 Node 后端,但等效的应该可以在任何语言中工作

// Worker Activity update policy
new Policy({
    url: util.workersUrl(workspaceSid, workerSid),
    method: 'POST',
    postFilter: {ActivitySid: {required: true}},
    allow: true,
  })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM