From b8c52f51ff24de27499d03926f75b1f5deb9a1f8 Mon Sep 17 00:00:00 2001 From: Nikhil Sinha Date: Sun, 22 Sep 2024 21:42:24 +0530 Subject: [PATCH] fix: OAuth error issue: already borrowed: BorrowMutError when try login with oauth because of req.connection_info() which makes an immutable borrow of req method extract_session_key_from_req() also borrows req because of which the server panics with the error fix is to use connection_info().clone() to avoid multiple borrows --- server/src/handlers/http/oidc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/handlers/http/oidc.rs b/server/src/handlers/http/oidc.rs index 3c9feb3f6..58c550b4c 100644 --- a/server/src/handlers/http/oidc.rs +++ b/server/src/handlers/http/oidc.rs @@ -63,7 +63,7 @@ pub async fn login( req: HttpRequest, query: web::Query, ) -> Result { - let conn = req.connection_info(); + let conn = req.connection_info().clone(); let base_url = format!("{}://{}/", conn.scheme(), conn.host()); if !base_url.eq(query.redirect.as_str()) { return Err(OIDCError::BadRequest);