diff mod_http_oauth2/mod_http_oauth2.lua @ 4276:ec33b3b1136c

mod_http_oauth2: Fix passing OAuth-specific error details Error 'context' isn't preserved when passed this way, that would be the second argument. Fits better in extras anyways.
author Kim Alvefur <zash@zash.se>
date Sat, 28 Nov 2020 21:22:16 +0100
parents 91b951fb3018
children 7cd3b7ec59e9
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Sat Nov 28 14:14:03 2020 +0100
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Sat Nov 28 21:22:16 2020 +0100
@@ -37,7 +37,7 @@
 		condition = "bad-request";
 		code = err_name == "invalid_client" and 401 or 400;
 		text = err_desc and (err_name..": "..err_desc) or err_name;
-		context = { oauth2_response = { error = err_name, error_description = err_desc } };
+		extra = { oauth2_response = { error = err_name, error_description = err_desc } };
 	});
 end
 
@@ -242,7 +242,7 @@
 local http_server = require "net.http.server";
 
 module:hook_object_event(http_server, "http-error", function (event)
-	local oauth2_response = event.error and event.error.context and event.error.context.oauth2_response;
+	local oauth2_response = event.error and event.error.extra and event.error.extra.oauth2_response;
 	if not oauth2_response then
 		return;
 	end