Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Improve token error reporting in Prosody JWT plugin

paweldomas5a95edbdcd77
diff --git a/prosody-plugins/mod_auth_token.lua b/prosody-plugins/mod_auth_token.lua
index 1b24e94c25..9a9befe773 100644
--- a/prosody-plugins/mod_auth_token.lua
+++ b/prosody-plugins/mod_auth_token.lua
@@ -80,6 +80,9 @@ function provider.get_sasl_handler(session)
-- here we check if 'room' claim exists
local room, roomErr = token_util.get_room_name(token, appSecret);
if room == nil then
+ if roomErr == nil then
+ roomErr = "'room' claim is missing";
+ end
return false, "not-allowed", roomErr;
end
diff --git a/prosody-plugins/token/util.lib.lua b/prosody-plugins/token/util.lib.lua
index c281c3d953..0f7c55364b 100644
--- a/prosody-plugins/token/util.lib.lua
+++ b/prosody-plugins/token/util.lib.lua
@@ -23,7 +23,7 @@ local function _verify_token(token, appId, appSecret, roomName)
local issClaim = claims["iss"];
if issClaim == nil then
- return nil, "Issuer field is missing";
+ return nil, "'iss' claim is missing";
end
if issClaim ~= appId then
return nil, "Invalid application ID('iss' claim)";
@@ -31,7 +31,7 @@ local function _verify_token(token, appId, appSecret, roomName)
local roomClaim = claims["room"];
if roomClaim == nil then
- return nil, "Room field is missing";
+ return nil, "'room' claim is missing";
end
if roomName ~= nil and roomName ~= roomClaim then
return nil, "Invalid room name('room' claim)";