我正在将Twilio Chat集成到我的Web应用程序中, 但是,当我传递服务器生成的访问令牌时, 它显示此错误。
我的代码段如下:
fetch(
URL,
{
headers: { "Content-Type": "application/x-www-form-urlencoded" },
method: "POST",
body: `identity=${encodeURIComponent(username)}`,
}
)
.then((res) => res.json())
.then(({ token }) => {
Chat.Client.create(token)
.then((client) => {
setupChatClient(client);
})
.catch(handleError);
})
.catch(handleError);
调用函数时,我确实传递了username
作为身份,API确实返回了令牌,但我只是不知道为什么它不高兴:(