comparison mod_http_oauth2/mod_http_oauth2.lua @ 5798:fdf3056021dc

mod_http_oauth2: Tweak fallback error text Since the oauth error is more like the error condition, a symbolic error code, not the most human-friendly. Many error cases do have human-readable error descriptions that should be fine on their own, or changed to be. As a fallback, capitalize the error name.
author Kim Alvefur <zash@zash.se>
date Sat, 23 Dec 2023 00:01:30 +0100
parents 03477980f1a9
children c75328aeaba3
comparison
equal deleted inserted replaced
5797:03477980f1a9 5798:fdf3056021dc
250 local function oauth_error(err_name, err_desc) 250 local function oauth_error(err_name, err_desc)
251 return errors.new({ 251 return errors.new({
252 type = "modify"; 252 type = "modify";
253 condition = "bad-request"; 253 condition = "bad-request";
254 code = err_name == "invalid_client" and 401 or 400; 254 code = err_name == "invalid_client" and 401 or 400;
255 text = err_desc and (err_name..": "..err_desc) or err_name; 255 text = err_desc or err_name:gsub("^.", string.upper):gsub("_", " ");
256 extra = { oauth2_response = { error = err_name, error_description = err_desc } }; 256 extra = { oauth2_response = { error = err_name, error_description = err_desc } };
257 }); 257 });
258 end 258 end
259 259
260 -- client_id / client_metadata are pretty large, filter out a subset of 260 -- client_id / client_metadata are pretty large, filter out a subset of