Each user opens a new jitsi meeting instead of joining the already created meeting


I am using the iframe api in my application to create jitsi meetings. I have a page from which the users can click a button and join the meeting. Once the first user joins the meeting, every other user who clicks on that button (after they have logged into the application) should join the already started meeting. But instead, anyone who clicks the button creates a new meeting where they are the only participant.
My code sample looks like this -

const options = {
roomName: ‘roomtest’,
width: 800,
height: 750,
parentNode: jitsiDiv,
configOverwrite: {
prejoinConfig: false,
disableDeepLinking: true,
disableInviteFunctions: true
userInfo: {
displayName: ‘testUser’
jwt: token

        var api = new JitsiMeetExternalAPI(videoDomain, options);

        api.on('readyToClose', () => {

For testing purposes, I have hard coded the room name and also the jwt token that I pass. The js console logs for two users (the first to join and the next one to join) are also added here.

jitsiConsoleError_moderator.txt (7.3 KB)
jitsiConsoleErrorUser.txt (7.1 KB)

Jitsi instances are on AWS ECS with the images created using docker. What am I doing wrong?

Nothing unusual in both logs. Two users trying to enter the same room at 2 minutes interval.

Your jwt token is missing sub field.

Which sub field do you mean? The jwt token is created using this code:
String jws = Jwts.builder().setIssuer(appName).setHeaderParam(“typ”, “JWT”).setHeaderParam(“alg”, “HS256”)
.claim(“name”, “appName”)
.claim(“room”, “*”)
.setAudience(“all”).setId(“123456”).signWith(key, SignatureAlgorithm.HS256).compact();

Tou can check about the fields here:

But if the problem was the jwt, you would see an error in the console. Maybe check prosody logs for errors.

I added sub (meet.jitsi) to my jwt creation but that didn’t resolve anything. Here are the jicofo and prosody logs.
jicofo.txt (7.6 KB)
prosody.txt (10.0 KB)

Yeah there are prosody errors which are the source of your problem, it should be something around the jwt.

The error in the prosody file is about missing sub:

Are you sure you have added it? Can you decode the generated jwt and use jwt.io to decode it and paste the structure here.

I was able to get it to work by changing my jwt code. Now it looks like this:

String token = Jwts.builder().setHeaderParam(“typ”, “JWT”).setHeaderParam(“alg”, “HS256”)
.claim(“room”, “*”)
.claim(“context”,context).setId(userId.toString()).signWith(key, SignatureAlgorithm.HS256).compact();

Thank you.