How can I change the presence from for the occupant?

I’m using setup with docker images and auth is done via JWT.

Is it possible to change the presence from value when an participant joins? Right now everytime a participant joins the room, the presence from is which test1 is the room name and after the slash a random string assigned.

What do you want to change it to?

a unique ID from JWT payload or other:

For the muc nickname you need to parse that and get the first part. But that is automatically done using the connection jid which can contain the whole uuid. lib-jitsi-meet/JitsiConference.js at d2179f31508f82fe51279ebe490740c3351d239f · jitsi/lib-jitsi-meet · GitHub

You can create a custom module that hooks to pre-jitsi-authentication extracts the id and returns it to be used as a custom username.

You will have the token in this filed of the session:

Actually you will just need to get the context user to get the id from there:

I added the auth_token module under XMPP_MODULES env var in docker compose. The module is loaded without any issues but the pre-jitsi-authentication event is never fired.

local inspect = require "inspect";

function on_pre_session(session)
	local context_user = session.jitsi_meet_context_user

	module:log(LOGLEVEL, 'CONTEXT_USER %s', inspect(context_user))

	return context_user['id']

module:hook('pre-jitsi-authentication', on_pre_session);

In the prosody debug when joining I see:

c2s55b0e7a4bb00                                              debug	SASL mechanisms supported by handler: ANONYMOUS
c2s55b0e7a4bb00                                              debug	Offering usable mechanisms: ANONYMOUS

It worked!

I changed

module:hook_global('pre-jitsi-authentication', on_pre_session);

You should already have auth token under the main virtual host if using jwt, probably your problem was that you are not loading your module under the main virtual host.
There is option for global modules to listen for hosts and make your module add the event only for the main virtual host.

That is the right place to put your custom module. But auth module is automatically loaded by prosody when you have authentication = "token" there, which I suppose you have.

To listen for the events you need to do it like this: