diff --git a/src/api/v1/auth/login.rs b/src/api/v1/auth/login.rs index 2391fdf..7779564 100644 --- a/src/api/v1/auth/login.rs +++ b/src/api/v1/auth/login.rs @@ -95,15 +95,15 @@ pub async fn response( let mut response = StatusCode::OK.into_response(); - response.headers_mut().insert( + response.headers_mut().append( "Set-Cookie", HeaderValue::from_str( &new_refresh_token_cookie(&app_state.config, refresh_token).to_string(), )?, ); - response.headers_mut().insert( - "Set-Cookie2", + response.headers_mut().append( + "Set-Cookie", HeaderValue::from_str( &new_access_token_cookie(&app_state.config, access_token).to_string(), )?, diff --git a/src/api/v1/auth/logout.rs b/src/api/v1/auth/logout.rs index 6e5e98d..906afcc 100644 --- a/src/api/v1/auth/logout.rs +++ b/src/api/v1/auth/logout.rs @@ -68,7 +68,7 @@ pub async fn res( cookie.make_removal(); response .headers_mut() - .append("Set-Cookie2", HeaderValue::from_str(&cookie.to_string())?); + .append("Set-Cookie", HeaderValue::from_str(&cookie.to_string())?); } Ok(response) diff --git a/src/api/v1/auth/refresh.rs b/src/api/v1/auth/refresh.rs index 2a7e611..b104a8e 100644 --- a/src/api/v1/auth/refresh.rs +++ b/src/api/v1/auth/refresh.rs @@ -71,7 +71,7 @@ pub async fn post( cookie.make_removal(); response .headers_mut() - .append("Set-Cookie2", HeaderValue::from_str(&cookie.to_string())?); + .append("Set-Cookie", HeaderValue::from_str(&cookie.to_string())?); } return Ok(response); @@ -119,21 +119,13 @@ pub async fn post( .execute(&mut conn) .await?; - if response.headers().get("Set-Cookie").is_some() { - response.headers_mut().append( - "Set-Cookie2", - HeaderValue::from_str( - &new_access_token_cookie(&app_state.config, access_token).to_string(), - )?, - ); - } else { - response.headers_mut().append( - "Set-Cookie", - HeaderValue::from_str( - &new_access_token_cookie(&app_state.config, access_token).to_string(), - )?, - ); - } + + response.headers_mut().append( + "Set-Cookie", + HeaderValue::from_str( + &new_access_token_cookie(&app_state.config, access_token).to_string(), + )?, + ); return Ok(response); } @@ -151,7 +143,7 @@ pub async fn post( cookie.make_removal(); response .headers_mut() - .append("Set-Cookie2", HeaderValue::from_str(&cookie.to_string())?); + .append("Set-Cookie", HeaderValue::from_str(&cookie.to_string())?); } Ok(response) diff --git a/src/api/v1/auth/register.rs b/src/api/v1/auth/register.rs index 06b63ca..237f1e0 100644 --- a/src/api/v1/auth/register.rs +++ b/src/api/v1/auth/register.rs @@ -169,7 +169,7 @@ pub async fn post( )?, ); response.headers_mut().append( - "Set-Cookie2", + "Set-Cookie", HeaderValue::from_str( &new_access_token_cookie(&app_state.config, access_token).to_string(), )?,