mod_http_oauth2: Fix returning errors from response handlers
This would either redirect the user back to the client along with the
error code, or show the error HTML template.
Previously this would just show some JSON to the user.
--- a/mod_http_oauth2/mod_http_oauth2.lua Wed May 17 19:40:27 2023 +0200
+++ b/mod_http_oauth2/mod_http_oauth2.lua Thu May 18 12:57:23 2023 +0200
@@ -754,7 +754,11 @@
if not response_handler then
return error_response(request, oauth_error("unsupported_response_type"));
end
- return response_handler(client, params, user_jid, id_token);
+ local ret = response_handler(client, params, user_jid, id_token);
+ if errors.is_err(ret) then
+ return error_response(request, ret);
+ end
+ return ret;
end
local function handle_revocation_request(event)