Tokbox 创建会话失败 [英] Tokbox failed to create session

查看:63
本文介绍了Tokbox 创建会话失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[Error: Failed to createSession. Error: An authentication error
occurred: (403) {"code":-1,"message":"Expired token"}]

我能够在我的本地主机服务器上很好地创建一个会话,但是当我把它投入生产 - 有 https - 发生错误.

I was able to create a session just fine on my localhost server, but when I put it in production - which has https - the error occurs.

我正在使用带有 Meteor 框架的 tokbox 并将函数包装在一个方法中:

I am using tokbox with Meteor framework and wraping the function inside a method:

const opentok = new OpenTok(Meteor.settings.public.opentok.apiKey, Meteor.settings.public.opentok.apiSecret);

let createSessionSync = Meteor.wrapAsync(opentok.createSession, opentok); 

推荐答案

当我们遇到这个问题时,重新启动我们的本地开发服务器并没有为我们解决问题.看起来开发人员正在更改他们机器上的时区设置,并且系统时钟以某种方式与开发服务器不同步(尽管此时时区设置为他的本地时间)但后来我们意识到 Docker 桌面正在创建错误的容器日期和时间.这支持上面@Adam Ullman 的评论.

Rebooting our local development servers did not fix the problem for us when we ran into this issue. It appeared the developer was changing timezone settings on their machine and the system clocks got out of sync with the development server somehow (though the timezone was set to his local time at the moment) but later we realized Docker desktop was creating containers with the wrong date and time. This supports the comment by @Adam Ullman above.

最初,我们通过在 Windows 系统设置中更改时区来解决此问题.此时错误消失了,而没有重新启动服务器.但是,请参阅下面的更新:

Initially, we solved this by changing the timezone in the Windows system settings. At this point the error went away without restarting the servers. However, see update below:

开发人员再次遇到了同样的问题,这次更改时区并没有解决它.我们意识到 Docker 容器是使用错误的时间设置创建的(我们通过注销容器中的当前时间来确定这一点).docker 容器中的日期比计算机时间晚了一天零几个小时.

The developer ran into the same issue again and timezone changing did not fix it this time. We realized that the Docker container was being created with the wrong time settings (We determined this by logging out the current time in the container). The date in the docker container was a day and several hours behind the computer's time.

需要注意的是,单独删除图像并重新启动容器并不能解决问题.此外,我们发现应用程序中的其他 JWT 令牌也受到影响,而不仅仅是 opentok 的.

It is important to note that deleting the images and restarting the containers alone did not solve the issue. Also, we found that other JWT tokens in the application were also affected not just opentok's.

为了解决这个问题,我们不得不停止 Docker Desktop 并重新启动它.这会将所有新创建的容器时间重新同步到 Windows 机器时间.

To solve this, we had to stop Docker Desktop and restart it. This resynchronized all newly created container times to the Windows machine time.

这篇关于Tokbox 创建会话失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆