Session.auth_token is null

module:hook(“muc-occupant-pre-join”, function (event)
local session = event.origin;
local token = session.auth_token; – Here the token is nil
– I would like to do some extra check with the token other than luajwtjitsi provides.


The other thread about using token with lobby room didn’t give me any clue. Is it because the token only brought in after join the room ?

What version of prosody do you use and are you using websockets or bosh? You have on that host enabled authentication token?

prosody/unknown,now 0.11.7-1~bionic4 amd64 [installed]

I’m using BOSH

info	BOSH client disconnected: session close

and in the host configuration, authentication is enabled.

VirtualHost ""
authentication = "token"

Component "" "muc"
modules_enabled = {
    "muc_mycustom"; <---

Trying to write a mod_muc_mycustom.lua to check session.auth_token.

Hum … that is strange … Here is where the token is checked … you can check is that code hit … So you can debug it, also turning in debug logs also helps

use debug log to check and i might have found the first the event got fired is from which should be passed it through. Am i correct ?


http.server     debug   Firing event: POST /http-bind
token_verification        debug Session token: nil, session room: nil
Will verify token for user:
muc_mycustom        debug   session.auth_token is nil <=== actually from so pass it through or ignore it..
token_verification	debug	pre join: MUC room ...
token_verification        debug   Session token: ewogICJ0eXAiOiAiS...(cut)
muc_mycustom        debug   session.auth_token got token = ewogICJ0eXAiOiAiS...(cut) <=== got token here is the actual user session.