Skip to content

Commit d97a63c

Browse files
Fix oauth2 5.0 compatibility issues
- Remove unused http_client function that required http crate - Create reqwest::Client instances for oauth2 request_async calls - Fix unused mut warning in bulk_email handler 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1458bc1 commit d97a63c

File tree

2 files changed

+6
-34
lines changed

2 files changed

+6
-34
lines changed

src/handlers/auth.rs

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,6 @@ use crate::{
4848
},
4949
};
5050

51-
// Async HTTP client for OAuth2 token requests using reqwest
52-
async fn http_client(
53-
request: oauth2::HttpRequest,
54-
) -> Result<oauth2::HttpResponse, Box<dyn std::error::Error + Send + Sync>> {
55-
use http::header::{HeaderName, HeaderValue};
56-
57-
let client = reqwest::Client::new();
58-
let method = request.method().clone();
59-
let url = request.uri().to_string();
60-
let headers = request.headers().clone();
61-
let body = request.body().clone();
62-
63-
let mut request_builder = client.request(method, &url).body(body);
64-
65-
for (name, value) in headers.iter() {
66-
request_builder = request_builder.header(name.as_str(), value.as_bytes());
67-
}
68-
69-
let response = request_builder.send().await?;
70-
71-
let status_code = response.status();
72-
let headers = response.headers().clone();
73-
let body = response.bytes().await?.to_vec();
74-
75-
let mut http_response = http::Response::builder().status(status_code);
76-
77-
for (name, value) in headers.iter() {
78-
http_response = http_response.header(name, value);
79-
}
80-
81-
Ok(http_response.body(body)?)
82-
}
83-
8451
pub async fn register(
8552
State(state): State<AppState>,
8653
Json(payload): Json<RegisterRequest>,
@@ -441,6 +408,7 @@ pub async fn google_callback(
441408
})?;
442409

443410
// Exchange the code for an access token
411+
let http_client = reqwest::Client::new();
444412
let token_result = client
445413
.exchange_code(AuthorizationCode::new(query.code))
446414
.request_async(&http_client)
@@ -713,6 +681,7 @@ pub async fn github_callback(
713681
})?;
714682

715683
// Exchange the code for an access token
684+
let http_client = reqwest::Client::new();
716685
let token_result = client
717686
.exchange_code(AuthorizationCode::new(query.code))
718687
.request_async(&http_client)
@@ -1047,6 +1016,7 @@ pub async fn apple_callback(
10471016
})?;
10481017

10491018
// Exchange the code for an access token
1019+
let http_client = reqwest::Client::new();
10501020
let _token_result = client
10511021
.exchange_code(AuthorizationCode::new(query.code.clone()))
10521022
.request_async(&http_client)
@@ -1341,6 +1311,7 @@ pub async fn facebook_callback(
13411311
})?;
13421312

13431313
// Exchange the code for an access token
1314+
let http_client = reqwest::Client::new();
13441315
let token_result = client
13451316
.exchange_code(AuthorizationCode::new(query.code))
13461317
.request_async(&http_client)
@@ -1654,6 +1625,7 @@ pub async fn linkedin_callback(
16541625
})?;
16551626

16561627
// Exchange the code for an access token
1628+
let http_client = reqwest::Client::new();
16571629
let token_result = client
16581630
.exchange_code(AuthorizationCode::new(query.code.clone()))
16591631
.request_async(&http_client)

src/handlers/bulk_email.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub async fn send_bulk_email(
104104
}
105105

106106
// Prepare variables for template rendering
107-
let mut variables = EmailVariables {
107+
let variables = EmailVariables {
108108
speaker_name: recipient.speaker_name.clone(),
109109
speaker_email: recipient.speaker_email.clone(),
110110
talk_title: recipient.talk_title.clone(),

0 commit comments

Comments
 (0)