diff --git a/backend/src/google_oauth.rs b/backend/src/google_oauth.rs index 8fd33f6..13f6181 100644 --- a/backend/src/google_oauth.rs +++ b/backend/src/google_oauth.rs @@ -1,16 +1,14 @@ -use axum_session::{Session, SessionAnyPool, SessionConfig, SessionStore, SessionLayer}; +use axum_session::{Session, SessionAnyPool}; use axum::{ - extract::{Extension, Query}, - http::header::{HeaderMap, SET_COOKIE}, + extract::Query, response::{IntoResponse, Redirect}, }; -use axum_server; use oauth2::{ - basic::BasicClient, reqwest::async_http_client, AuthUrl, AuthorizationCode, ClientId, + basic::BasicClient, AuthUrl, ClientId, ClientSecret, CsrfToken, PkceCodeChallenge, RedirectUrl, Scope, TokenUrl, }; use serde::Deserialize; -use std::{collections::HashMap, env}; +use std::env; #[derive(Debug, Deserialize)] #[allow(dead_code)] @@ -20,10 +18,10 @@ pub struct AuthRequest { } pub async fn google_auth() -> impl IntoResponse { - let (pkce_code_challenge, pkce_code_verifier) = PkceCodeChallenge::new_random_sha256(); + let (pkce_code_challenge, _pkce_code_verifier) = PkceCodeChallenge::new_random_sha256(); // Generate the authorization URL to which we'll redirect the user. - let (auth_url, csrf_state) = google_oauth_client() + let (auth_url, _csrf_state) = google_oauth_client() .authorize_url(CsrfToken::new_random) .add_scope(Scope::new( "https://www.googleapis.com/auth/userinfo.profile".to_string(), @@ -38,7 +36,7 @@ pub async fn google_auth() -> impl IntoResponse { Redirect::to(&auth_url.to_string()) } -pub async fn google_authorized(session: Session, +pub async fn google_authorized(_session: Session, Query(query): Query, // Extension(oauth_clients): Extension>, ) -> impl IntoResponse { diff --git a/backend/src/main.rs b/backend/src/main.rs index 7e18788..15c489c 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -1,12 +1,11 @@ -use std::{net::SocketAddr, collections::HashMap}; +use std::net::SocketAddr; use askama::Template; use axum_session::{Session, SessionAnyPool, SessionConfig, SessionStore, SessionLayer}; use axum::{ Router, - routing::{get, get_service}, response::{Html, IntoResponse, Response}, Extension + routing::{get, get_service}, response::{Html, IntoResponse, Response}, }; use http::StatusCode; -use oauth2::basic::BasicClient; use serde::{Serialize, Deserialize}; use tower_http::services::ServeDir;