commit 1bf4878630654003cb89c9dd86cf0fe57d9ae976
parent 59ee2147f50ef1112a6fadc11cfaaf5b6e5be8b8
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Wed, 15 Jul 2026 23:47:49 +0200
refine status returned for missing grant_type
Diffstat:
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/challenger/challenger-httpd_token.c b/src/challenger/challenger-httpd_token.c
@@ -272,9 +272,20 @@ CH_handler_token (struct CH_HandlerContext *hc,
return MHD_YES;
return MHD_NO;
}
- if ( (NULL == bc->grant_type) ||
- (0 != strcmp (bc->grant_type,
- "authorization_code")) )
+ if (NULL == bc->grant_type)
+ {
+ /* RFC 6749 5.2: a missing required parameter is 'invalid_request', not
+ 'unsupported_grant_type' (the latter is for a present, wrong value). */
+ GNUNET_break_op (0);
+ return CH_reply_with_oauth_error (
+ hc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ "invalid_request",
+ TALER_EC_GENERIC_PARAMETER_MISSING,
+ "grant_type");
+ }
+ if (0 != strcmp (bc->grant_type,
+ "authorization_code"))
{
GNUNET_break_op (0);
return CH_reply_with_oauth_error (