reactjs - Twilio 聊天包导致应用程序在 reactjs 中使用错误的令牌崩溃
问题描述
我正在验证 Twilio 凭据,然后再将它们保存到 db。所以在前端 reactjs 我从后端获得一个令牌,我需要通过 twilio-chat 客户端。因此,如果这成功,我将显示 twilio 聊天凭据很好,但如果我更改 apiKey,我会得到错误的令牌,所以当我将此令牌传递给 twilio-chat 客户端时。它在一段时间后使应用程序崩溃。
import Client from "twilio-chat";
Client.create(data?.testUserAccessToken)
.then((client) => {
if (client) {
notify.notification({
type: "success",
message: "Successfully Tested"
});
})
.catch((error) => {
// console.log(error);
notify.notification({
type: "warning",
message: "Invalid Credentials."
});
});
我正在使用 twilio-chat 4.0.0 版。
你们能帮我解决我在这里缺少的或做错的事情吗?这对我很有帮助。谢谢
解决方案
推荐阅读
- sql - 外部连接错误 - 加入日期与日期
- javascript - 如何在 ReactJS 中处理增加和减少帖子
- asp.net-core - EditorTemplate asp-for="Property" vs value="@Model.Property"
- cloudflare-workers - 使用 cloudflare 工作人员修改链接 href
- aws-lambda - Dynamo Db 从表中删除重复条目
- javascript - jquery .one(“点击”,函数())
- sql - 在 hive 1.2.1 中查看子查询
- nginx - 为什么 nginx 在状态码中没有返回 OK
- javascript - 文件上传后返回空对象 - Apollo graphql
- ios - 什么样的 swift 数据类型我们不能从 ObjectiveC 代码中通信/调用?