aboutsummaryrefslogtreecommitdiffstats
path: root/src/server/routes/auth
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/routes/auth')
-rw-r--r--src/server/routes/auth/discord.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/server/routes/auth/discord.rs b/src/server/routes/auth/discord.rs
index 036a35a..b141ce7 100644
--- a/src/server/routes/auth/discord.rs
+++ b/src/server/routes/auth/discord.rs
@@ -1,11 +1,17 @@
-use std::sync::Arc;
+use activitypub_federation::config::Data;
+use axum::response::IntoResponse;
+use oauth2::{CsrfToken, Scope};
-use axum::{extract::State, response::IntoResponse};
+use crate::server::{error::AppError, state::AppState};
-use crate::server::{driver::SellershutDriver, error::AppError};
+pub(super) async fn discord_auth(data: Data<AppState>) -> Result<impl IntoResponse, AppError> {
+ let data = data.app_data();
-async fn auth(
- State(client): State<Arc<dyn SellershutDriver>>,
-) -> Result<impl IntoResponse, AppError> {
- Ok(())
+ let (auth_url, csrf_token) = data
+ .oauth_discord
+ .authorize_url(CsrfToken::new_random)
+ .add_scope(Scope::new("identify".to_string()))
+ .url();
+
+ Ok(String::default())
}