mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-08-14 14:29:50 +00:00
14 lines
449 B
Rust
14 lines
449 B
Rust
use axum::{Form, Json, extract::State, response::IntoResponse};
|
|
use http::StatusCode;
|
|
use service::oauth::grant::DeviceCodeRequest;
|
|
|
|
pub(crate) async fn device_authorization_route(
|
|
State(services): State<crate::State>,
|
|
Form(request): Form<DeviceCodeRequest>,
|
|
) -> impl IntoResponse {
|
|
match services.oauth.request_device_code(request).await {
|
|
| Ok(response) => Ok(Json(response)),
|
|
| Err(err) => Err((StatusCode::BAD_REQUEST, Json(err))),
|
|
}
|
|
}
|