Lib-jitsi-meet JWT support with websockets

Hey there!

In lib-jitsi-meet documentation on authentication with JWT (https://github.com/jitsi/lib-jitsi-meet/blob/master/doc/tokens.md) it’s currently been said that JWT authentication is supported only with BOSH:

JWT token authentication currently works only with BOSH connections.

We are wondering if this is currently still the case and if it is are there any plans to add Websocket support in a more recent future.

Thanks for the awesome product you’re all building!

It is just that document needs an update. JWT is supported with websockets and we use that already in production.

@damencho That’s really awesome! In order to pass in the token, can we continue using JitsiMeetJS.JitsiConnection for ws too just like with BOSH?

Yes.

1 Like

Awesome! Thanks so much!

This is very good news!!!

@damencho Right now when somebody’s connection drops, we’re relying on BOSH to timeout his connection and such users will get kicked out of the conference after the timeout expires. How do you handle this kind of situation with Websockets?

mod_smacks.lua hibernates the session and waits for 60 seconds for the reconnection if that does not happen the session is closed. The result is the same behavior in the UI as with bosh.

Cool! Thanks so much!

I am having trouble getting ws to work with jwt. It works fine with BOSH. Just confirming that websockets does in fact work with jwt’s and wondering if there is anything else I have to do?

I’m getting CONNECTION FAILED: connection.passwordRequired with websockets when there’s a jwt but as a guest without jwt, ws works.

Other logging:
JWT error: token required

react_devtools_backend.js:2556 2021-04-15T18:36:02.019Z [features/base/conference] JWT parsing error: ["- Key ID(kid) missing"]

1 Like

Do you have the latest version of Prosody? Some versions do not fire the websocket-session event on session creation, thus jwt will not be verified. I do not know which version/commit features the change but here’s a helpful patch which will give you the idea what to look for and where in your Prosody:

If you find you’re missing this line, you can either apply the patch or upgrade to the latest Prosody version.

1 Like

Totally solved it!! Thank you.

This is what I exactly faced. Any solution?

You need prosody 0.11.6 or newer. If you are using anything before 0.11.6 you need to apply the patch from above by hand.

Hi @damencho
Here is my prosody version.
image

Do you mean uncomment this line?
module:fire_event("websocket-session", { session = session, request = request });

Why not just upgrade prosody and save yourself the extra issues (and there will be more of them if you stay with your current version)?

Hi @Freddie
Thank you very much for your help. Is there any documentation that helps for success this?

2 Likes