fix: 恢复被误删的 AuthCodeURL 调用,修复编译失败

上次提交误删了 url := o2conf.AuthCodeURL(...) 导致编译失败。
同时添加注释说明 Cookie Secure 属性动态设置的原因。

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
naiba
2026-03-01 04:05:42 +00:00
parent 589563e744
commit a5d4537a8c
+2
View File
@@ -65,6 +65,8 @@ func oauth2redirect(c *gin.Context) (*model.Oauth2LoginResponse, error) {
RedirectURL: redirectURL,
}, cache.DefaultExpiration)
url := o2conf.AuthCodeURL(state, oauth2.AccessTypeOnline)
// CodeQL go/cookie-secure-not-set: 根据请求协议动态设置 Secure 属性,避免 HTTP 环境下 Cookie 无法使用
c.SetCookie("nz-o2s", stateKey, 60*5, "", "", c.Request.URL.Scheme == "https" || c.Request.TLS != nil, false)
return &model.Oauth2LoginResponse{Redirect: url}, nil