Unable to Authenticate With JWT Tokens

Hi after reading tons of posts and articles from this community forum, I tried my best to solve these issues by myself. Still, I am facing a problem with this.

This is the output in my Console Log

This is my prosody.log file data
Apr 12 14:34:03 startup info Hello and welcome to Prosody version 0.11 nightly build 81 (2020-03-12, 27d15097c235)
Apr 12 14:34:03 startup info Prosody is using the select backend for connection handling
Apr 12 14:34:03 modulemanager error Error initializing module ‘auth_token’ on ‘abc.xyz.com’: /usr/lib/prosody/util/startup.lua:199: module ‘basexx’ not found:No LuaRocks module found for basexx
no field package.preload[‘basexx’]
no file ‘/usr/lib/prosody/basexx.lua’
no file ‘/usr/local/share/lua/5.2/basexx.lua’
no file ‘/usr/local/share/lua/5.2/basexx/init.lua’
no file ‘/usr/local/lib/lua/5.2/basexx.lua’
no file ‘/usr/local/lib/lua/5.2/basexx/init.lua’
no file ‘/usr/share/lua/5.2/basexx.lua’
no file ‘/usr/share/lua/5.2/basexx/init.lua’
no file ‘/root/.luarocks/share/lua/5.2/basexx.lua’
no file ‘/root/.luarocks/share/lua/5.2/basexx/init.lua’
no file ‘/usr/lib/prosody/basexx.so’
no file ‘/usr/local/lib/lua/5.2/basexx.so’
no file ‘/usr/lib/x86_64-linux-gnu/lua/5.2/basexx.so’
no file ‘/usr/lib/lua/5.2/basexx.so’
no file ‘/usr/local/lib/lua/5.2/loadall.so’
no file ‘/root/.luarocks/lib/lua/5.2/basexx.so’
stack traceback:
[C]: in function ‘_real_require’
This is my setup details (with original key and app_id, I’ll change it later on in prod instance :slight_smile:)

    VirtualHost "abc.xyz.com"
            -- enabled = false -- Remove this line to enable this host
            authentication = "token";
            -- Properties below are modified by jitsi-meet-tokens package config
            -- and authentication above is switched to "token"
            app_id="example_app_id";
            app_secret="supersecret";
            allow_emplty_token = false;

I am using this payload to generate JWT token from jwt.io

    { 
      "sub": "abc.xyz.com",
      "iss": "example_app_id",
      "aud": "example_app_id",
      "room": "*",
  "exp": 1586792720
}

HMACSHA256(
      base64UrlEncode(header) + "." +
      base64UrlEncode(payload),
      supersecret
) 

Kindly help me here, I’ll try my best to resolve this issue ASAP.

Same here :exploding_head:
Just to be sure, is HS256 allowed ? or do we need RS256 ?

1 Like

Yes, we can use HS256 as it is mentioned in official doc https://github.com/jitsi/lib-jitsi-meet/blob/master/doc/tokens.md

Secret is used to compute HMAC hash value and verify the token for HS256 tokens.

1 Like

@rohitcoder Have you resolved this issue? I’m running into it as well.

I’ve tried following other threads (such as Token authentication working with prosody 747 but not with latest version. Ubuntu 18.04), but without success.

These mainly focus on the issue “module ‘luajwtjitsi’ not found”, but im running into the same message on basexx as you do.

@stil4m,

First check if luarocks is ready and installed. Then

luarocks install luajwtjitsi
luarocks install basexxx

now restart all services and see if it works, i fixed it by installing these manually

1 Like

None of the answers worked, and after few months i found a great solution.

This is more detailed answer and it works 100% for most of the guys and it also worked for me https://github.com/jitsi/lib-jitsi-meet/issues/1082#issuecomment-616948457 don’t forget to thank this guy after solving your issue :slight_smile: :grinning: