mod_http_oauth2: Fix removal of consumed authorization codes
Fixes mod_http_oauth2.lua:34: bad argument #2 to 'difftime' (number expected, got nil)
The extra preceding argument to :set stored the client-id#code as a value
instead of clearing the key, and then later in the periodic cleanup
timer this string would be indexed, producing a nil and a traceback
--- a/mod_http_oauth2/mod_http_oauth2.lua Wed Mar 01 13:21:29 2023 +0000
+++ b/mod_http_oauth2/mod_http_oauth2.lua Wed Mar 01 21:11:48 2023 +0100
@@ -166,7 +166,7 @@
module:log("debug", "authorization_code invalid or expired: %q", code);
return oauth_error("invalid_client", "incorrect credentials");
end
- assert(codes:set(client_owner, client_id .. "#" .. params.code, nil));
+ assert(codes:set(client_id .. "#" .. params.code, nil));
return json.encode(new_access_token(code.granted_jid, code.granted_scopes, nil));
end