当前位置:网站首页>How does easygbs, a national standard platform, solve the problem that information cannot be carried across domains?

How does easygbs, a national standard platform, solve the problem that information cannot be carried across domains?

2022-06-24 12:16:00 Tsingsee green rhino video

EasyGBS、EasyNVR、EasyCVR And other live video platforms have very rich secondary development interfaces , Users can freely call for secondary development . Some users call EasyGBS During the secondary development of the interface , Due to the cross domain problem, the user information is cookie I can't carry it with me , Therefore, the correct user information cannot be obtained , This will affect the calling of the interface .

For the problem of this interface call , It needs to be optimized . The information carrying problem is caused by cross domain , We're going to start with URL Found later token, And then through token Carry information . 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 {

// from URL Found later 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)

}

}

Then test again , Interface call display is normal .

EasyGBS Support the video stream transmission of national standard protocol , After years of development and optimization , It has become a stable and reliable video streaming media platform , It has played a role in many industries , For example, the common culture, education and health 、 The Internet of things 、 Smart city, etc ,EasyGBS Its high openness also determines that it can seamlessly connect with the additional functions of any industry , If you're interested , Welcome to download the test directly , The test version can also call the interface for secondary development .

原网站

版权声明
本文为[Tsingsee green rhino video]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/06/20210604113031840m.html