[英]JsSIP: User is logged out when browser refreshed
I have a simple browser SIP phone. 我有一个简单的浏览器SIP电话。 It is a single page application which is based on the JsSIP library.
它是一个基于JsSIP库的单页应用程序。 It has two input fields login and password.
它有两个输入字段登录名和密码。 After authentication it shows me a dial panel.
验证后,它会显示一个拨号面板。 When I refresh a page it shows me again authentication form.
当我刷新页面时,它将再次显示身份验证表单。
How to restore a session after a page refresh and keep user logged in? 页面刷新后如何恢复会话并保持用户登录状态?
You can't save the login session of JsSIP in browser cache like HTTP auth. 您无法将JsSIP的登录会话保存在HTTP身份验证之类的浏览器缓存中。
JsSIP does a SIP session over Websocket to server. JsSIP通过Websocket与服务器进行SIP会话。
You have to pass user credentials to JsSIP new JsSIP.UA(configuration);
您必须将用户凭证传递给JsSIP
new JsSIP.UA(configuration);
each time a browser reloads/refresh. 每次浏览器重新加载/刷新时。 Maybe you can store the credentials in browser cookie or localStorage and use it to initialise JsSIP on refresh.
也许您可以将凭据存储在浏览器cookie或localStorage中,并在刷新时使用它来初始化JsSIP。 But security is up to you decide on which environment your app runs.
但是安全性取决于您决定您的应用在哪个环境上运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.