fix: correct yup-oauth2 types (Authenticator, AccessToken, ApplicationSecret fields)

This commit is contained in:
Ruben Rosario
2026-06-21 10:10:22 +01:00
parent 532e13caef
commit 9da086b7be
3 changed files with 470 additions and 192 deletions
+10 -6
View File
@@ -1,7 +1,11 @@
use std::path::PathBuf;
use reqwest::Client;
use yup_oauth2::{InstalledFlowAuthenticator, InstalledFlowReturnMethod, ApplicationSecret};
use yup_oauth2::{
authenticator::Authenticator, hyper::client::connect::HttpConnector,
hyper_rustls::HttpsConnector, ApplicationSecret, InstalledFlowAuthenticator,
InstalledFlowReturnMethod,
};
use crate::domain::models::*;
@@ -26,7 +30,7 @@ impl std::error::Error for ApiError {}
pub struct ApiClient {
client: Client,
authenticator: InstalledFlowAuthenticator,
authenticator: Authenticator<HttpsConnector<HttpConnector>>,
token_path: PathBuf,
}
@@ -49,9 +53,9 @@ impl ApiClient {
auth_uri: "https://accounts.google.com/o/oauth2/v2/auth".to_string(),
token_uri: "https://oauth2.googleapis.com/token".to_string(),
redirect_uris: vec!["http://127.0.0.1:8080/".to_string()],
client_email: String::new(),
client_x509_cert_url: String::new(),
project_id: String::new(),
client_email: None,
client_x509_cert_url: None,
project_id: None,
..Default::default()
};
@@ -88,7 +92,7 @@ impl ApiClient {
.token(SCOPES)
.await
.map_err(|e| ApiError::Auth(format!("Token error: {}", e)))?;
Ok(token.as_str().to_string())
Ok(token.token().unwrap_or("").to_string())
}
pub async fn fetch_lists(&self) -> Result<Vec<TaskList>, ApiError> {