mod_auth_oauth_external/mod_auth_oauth_external.lua
changeset 5444 82a14082be3f
parent 5443 721f79ac88d8
child 5446 7480dde4cd2e
--- a/mod_auth_oauth_external/mod_auth_oauth_external.lua	Wed May 10 13:45:28 2023 +0200
+++ b/mod_auth_oauth_external/mod_auth_oauth_external.lua	Wed May 10 13:52:31 2023 +0200
@@ -71,9 +71,12 @@
 				return false, nil;
 			end
 			local response = json.decode(ret.body);
-			if type(response) ~= "table" or (response[username_field]) ~= username then
+			if type(response) ~= "table" then
+				return false, nil, nil;
+			elseif type(response[username_field]) ~= "string" then
 				return false, nil, nil;
 			end
+			self.username = jid.escape(response[username_field]);
 			self.token_info = response;
 			return true, true;
 		end