'How to set samesite=none, secure=true in Beego?

I have to set cookies as samesite = none and secure = true for my 3D pay URL. I've spent a lot of time trying to solve problem. How can i do it?

simple example for PHP

setcookie('cross-site-cookie', 'bar', ['samesite' => 'None', 'secure' => true]);

I tried this method in Beego:

beego.BConfig.WebConfig.Session.SessionCookieSameSite = http.SameSiteNoneMode


Solution 1:[1]

hope this would help you:

http.SetCookie(c.Ctx.ResponseWriter, &http.Cookie{
                Name:     "sessionid",
                Value:    c.CruSession.SessionID(),
                Path:     "/",
                Domain:   "",
                MaxAge:   86400,
                Secure:   true,
                HttpOnly: true,
                SameSite: http.SameSiteNoneMode,
            })

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yan Zhili