comparison mod_http_oauth2/mod_http_oauth2.lua @ 5462:f6d8830a83fe

mod_http_oauth2: Return proper OAuth error for invalid redirect URI An unspecific status code of 400 isn't very helpful, this should at least provide a hint as to what is wrong.
author Kim Alvefur <zash@zash.se>
date Wed, 17 May 2023 16:34:19 +0200
parents 06640647d193
children dacde53467f3
comparison
equal deleted inserted replaced
5461:06640647d193 5462:f6d8830a83fe
335 message = "Here's your authorization code, copy and paste it into " .. (client.client_name or "your client"); 335 message = "Here's your authorization code, copy and paste it into " .. (client.client_name or "your client");
336 extra = code; 336 extra = code;
337 }) or ("Here's your authorization code:\n%s\n"):format(code); 337 }) or ("Here's your authorization code:\n%s\n"):format(code);
338 return response; 338 return response;
339 elseif not redirect_uri then 339 elseif not redirect_uri then
340 return 400; 340 return oauth_error("invalid_redirect_uri");
341 end 341 end
342 342
343 local redirect = url.parse(redirect_uri); 343 local redirect = url.parse(redirect_uri);
344 344
345 local query = http.formdecode(redirect.query or ""); 345 local query = http.formdecode(redirect.query or "");