mod_http_oauth2/mod_http_oauth2.lua
changeset 4674 1b81b7269858
parent 4673 d3434fd151b5
child 5002 5ab134b7e510
--- a/mod_http_oauth2/mod_http_oauth2.lua	Thu Sep 02 23:03:41 2021 +0200
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Thu Sep 02 23:06:58 2021 +0200
@@ -102,11 +102,14 @@
 	local granted_scopes = filter_scopes(granted_jid, params.scope);
 
 	local code = uuid.generate();
-	assert(codes:set(params.client_id .. "#" .. code, {
+	local ok = codes:set(params.client_id .. "#" .. code, {
 		issued = os.time();
 		granted_jid = granted_jid;
 		granted_scopes = granted_scopes;
-	}));
+	});
+	if not ok then
+		return {status_code = 429};
+	end
 
 	local redirect = url.parse(params.redirect_uri);
 	local query = http.formdecode(redirect.query or "");