Cleanup warnings
This commit is contained in:
parent
bfa9433350
commit
3691056d9f
|
|
@ -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<SessionAnyPool>,
|
||||
pub async fn google_authorized(_session: Session<SessionAnyPool>,
|
||||
Query(query): Query<AuthRequest>,
|
||||
// Extension(oauth_clients): Extension<HashMap<&str, BasicClient>>,
|
||||
) -> impl IntoResponse {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue