@@ -11,9 +11,14 @@ func SetCookie(gc *gin.Context, token string) {
1111 secure := true
1212 httpOnly := true
1313 host := GetHostName (constants .AUTHORIZER_URL )
14+ domain := GetDomainName (constants .AUTHORIZER_URL )
15+ if domain != "localhost" {
16+ domain = "." + domain
17+ }
1418
1519 gc .SetSameSite (http .SameSiteNoneMode )
1620 gc .SetCookie (constants .COOKIE_NAME , token , 3600 , "/" , host , secure , httpOnly )
21+ gc .SetCookie (constants .COOKIE_NAME + "-client" , token , 3600 , "/" , domain , secure , httpOnly )
1722}
1823
1924func GetCookie (gc * gin.Context ) (string , error ) {
@@ -29,8 +34,13 @@ func DeleteCookie(gc *gin.Context) {
2934 secure := true
3035 httpOnly := true
3136
32- host := GetHostName (constants .AUTHORIZER_URL )
37+ host := GetDomainName (constants .AUTHORIZER_URL )
38+ domain := GetDomainName (constants .AUTHORIZER_URL )
39+ if domain != "localhost" {
40+ domain = "." + domain
41+ }
3342
3443 gc .SetSameSite (http .SameSiteNoneMode )
3544 gc .SetCookie (constants .COOKIE_NAME , "" , - 1 , "/" , host , secure , httpOnly )
45+ gc .SetCookie (constants .COOKIE_NAME + "-client" , "" , - 1 , "/" , domain , secure , httpOnly )
3646}
0 commit comments