blob: b0305f66894e4763e13d44b90e8e6e594ac41e0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use activitypub_federation::config::Data;
use axum::response::IntoResponse;
use oauth2::{CsrfToken, Scope};
use crate::server::{error::AppError, state::AppState};
pub(super) async fn discord_auth(data: Data<AppState>) -> Result<impl IntoResponse, AppError> {
let data = data.app_data();
let (auth_url, csrf_token) = data
.oauth_discord
.authorize_url(CsrfToken::new_random)
.add_scope(Scope::new("identify".to_string()))
.url();
dbg!(&auth_url);
let response = data
.driver
.create_auth_session(&csrf_token, &auth_url)
.await?;
Ok(response)
}
|