mod_tokenauth: Delete grants in the wrong formats on retrieval
authorKim Alvefur <zash@zash.se>
Mon, 09 Oct 2023 20:26:30 +0200
changeset 13275 56c1d2498d66
parent 13274 14bbfb2cc8dd
child 13276 8535a6105919
mod_tokenauth: Delete grants in the wrong formats on retrieval
plugins/mod_tokenauth.lua
--- a/plugins/mod_tokenauth.lua	Sun Oct 15 16:43:14 2023 +0200
+++ b/plugins/mod_tokenauth.lua	Mon Oct 09 20:26:30 2023 +0200
@@ -159,6 +159,11 @@
 		return nil, "expired";
 	end
 
+	if not grant.tokens then
+		module:log("debug", "Token grant without tokens, cleaning up");
+		token_store:set_key(username, grant.id, nil);
+		return nil, "invalid";
+	end
 	return grant;
 end