diff --git a/lib/komainu/src/code_grant.rs b/lib/komainu/src/code_grant.rs index d006b3a38..902c7a21a 100644 --- a/lib/komainu/src/code_grant.rs +++ b/lib/komainu/src/code_grant.rs @@ -62,7 +62,7 @@ where } #[instrument(skip_all)] - pub async fn extract<'a>( + pub async fn extract_raw<'a>( &'a self, req: &'a http::Request<()>, ) -> Result, GrantError> { @@ -72,11 +72,6 @@ where let client_id = query.get("client_id").or_invalid_request()?; let response_type = query.get("response_type").or_invalid_request()?; - if *response_type != "code" { - debug!(?client_id, "response_type not set to \"code\""); - return Err(GrantError::AccessDenied); - } - let scope = query.get("scope").map(Deref::deref).unwrap_or(""); let state = query.get("state").map(|state| &**state); @@ -88,6 +83,11 @@ where } } + if *response_type != "code" { + debug!(?client_id, "response_type not set to \"code\""); + return Err(GrantError::AccessDenied); + } + let request_scopes = scope.split_whitespace().collect::>(); let client_scopes = client .scopes