(
State(_state): State<Arc<ServerState>>,
Path(id): Path<String>,
Json(req): Json<OAuthAuthorizeRequest>,
)
| 2350 | } |
| 2351 | |
| 2352 | async fn oauth_authorize( |
| 2353 | State(_state): State<Arc<ServerState>>, |
| 2354 | Path(id): Path<String>, |
| 2355 | Json(req): Json<OAuthAuthorizeRequest>, |
| 2356 | ) -> Result<Json<OAuthAuthorizeResponse>> { |
| 2357 | let loader = get_plugin_loader() |
| 2358 | .ok_or_else(|| ApiError::NotFound("no plugin loader initialized".to_string()))?; |
| 2359 | let authorization = ProviderAuth::authorize(loader, &id, req.method, None) |
| 2360 | .await |
| 2361 | .map_err(|e| ApiError::BadRequest(e.to_string()))?; |
| 2362 | |
| 2363 | Ok(Json(OAuthAuthorizeResponse { |
| 2364 | url: authorization.url, |
| 2365 | method_type: match authorization.method { |
| 2366 | AuthMethodType::Auto => "auto".to_string(), |
| 2367 | AuthMethodType::Code => "code".to_string(), |
| 2368 | }, |
| 2369 | instructions: authorization.instructions, |
| 2370 | })) |
| 2371 | } |
| 2372 | |
| 2373 | #[derive(Debug, Deserialize)] |
| 2374 | pub struct OAuthCallbackRequest { |
nothing calls this directly
no test coverage detected