File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,13 +156,13 @@ pub fn build_refresh_cookie(token: &str) -> String {
156156 if is_dev {
157157 // 开发环境:不设置 Secure,使用 SameSite=Lax
158158 format ! (
159- "refresh_token={}; HttpOnly; SameSite=Lax; Path=/api/auth ; Max-Age={}" ,
159+ "refresh_token={}; HttpOnly; SameSite=Lax; Path=/; Max-Age={}" ,
160160 token, max_age
161161 )
162162 } else {
163163 // 生产环境:设置 Domain 使 Cookie 在主域下共享,避免被浏览器当作第三方 Cookie 拦截
164164 format ! (
165- "refresh_token={}; HttpOnly; Secure; SameSite=None; Domain=.exquisitecore.xyz; Path=/api/auth ; Max-Age={}" ,
165+ "refresh_token={}; HttpOnly; Secure; SameSite=None; Domain=.exquisitecore.xyz; Path=/; Max-Age={}" ,
166166 token, max_age
167167 )
168168 }
@@ -174,9 +174,9 @@ pub fn build_clear_refresh_cookie() -> String {
174174 let is_dev = config. cors . allowed_origins . iter ( ) . all ( |o| o. contains ( "localhost" ) ) ;
175175
176176 if is_dev {
177- "refresh_token=; HttpOnly; SameSite=Lax; Path=/api/auth ; Max-Age=0" . to_string ( )
177+ "refresh_token=; HttpOnly; SameSite=Lax; Path=/; Max-Age=0" . to_string ( )
178178 } else {
179- "refresh_token=; HttpOnly; Secure; SameSite=None; Domain=.exquisitecore.xyz; Path=/api/auth ; Max-Age=0" . to_string ( )
179+ "refresh_token=; HttpOnly; Secure; SameSite=None; Domain=.exquisitecore.xyz; Path=/; Max-Age=0" . to_string ( )
180180 }
181181}
182182
You can’t perform that action at this time.
0 commit comments