How does the national standard platform EasyGBS solve the problem of inability to carry information brought about by cross-domain?

Video live broadcast platforms such as EasyGBS, EasyNVR, and EasyCVR all have very rich secondary development interfaces, which users can freely call for secondary development. When some users conduct secondary development by calling the EasyGBS interface, the user information cannot be carried in the cookie due to cross-domain issues, so the correct user information cannot be obtained, which affects the call of the interface.

47.png

For the problems that occur in this interface call, some optimizations are needed. Because of the information carrying problem caused by cross-domain, we need to query the token from behind the URL, and then carry the information through the token. Add the following code:

return func(c *gin.Context) {   session := sessions.Default(c)   uname := session.Get("uname")   uid := session.Get("uid")    //log.Printf("SetUsername() --> uname = %v    uid = %v", uname, uid)    if uname == nil || uid == nil {      // 从URL后面查询出token      token := c.Query("token")       if token != "" {         uname = sessions.GetNameByToken(db.SQLite /*models.DB*/, store, token)         uid = sessions.GetIdByToken(db.SQLite /*models.DB*/, store, token)       }   }

After the test was performed again, the interface call showed normal.

48.png

EasyGBS supports the video streaming transmission of the national standard protocol. After years of development and optimization, it has become a stable and reliable video streaming platform, which has played a role in many industries, such as common culture, education, health, Internet of things, smart cities, etc. EasyGBS The high degree of openness is also destined to seamlessly connect with the additional functions of any industry. If you are interested, please download and test directly. The test version can also call the interface for secondary development.

GBS2.png