Prosody module for persistent passwords / How to pass password with http query

Hello,
I implemented a module:

module:hook("muc-room-pre-create", function(event)
            local pass = http.query.for.password for this event.room;
            event.room:set_password(pass);
end);

It works fine if I hardcode the pass string variable:

module:hook("muc-room-pre-create", function(event)
            local pass = "password";
            event.room:set_password(pass);
end);

My question is how do I pass the password with the http.query.for.password in the example upwards. Does it parse it from the URL?

I’m assuming you are referencing this post?

I think that’s just a placeholder where you’re meant to implement an actual HTTP call there to query some endpoint somewhere, then parse the results to retrieve the intended password.

I don’t have a ready implementation at hand to offer you, but if it helps, I’m working on extending the reservations module so you can dynamically set passwords (and enable lobby) by setting values in the response payload. This is still a work in progress – feat(reservations) start lobby and set password from reservation by shawnchin · Pull Request #12215 · jitsi/jitsi-meet · GitHub.

1 Like

If you want to go ahead with implementing your own solution, a few things to consider:

  1. Make sure you use a blocking http call and not async. Otherwise users could join the conference before the API call returns and password won’t yet be set. Perhaps use this function – http_get_with_retry
  2. Because the calls will be synchronous, a slow response time from API could result in performance and usability issues.
  3. You need to secure the API so it’s not publicly viewable but still accessible by the plugin. The http_get_with_retry already supports header-based auth tokens so that’s an option.
  4. You’ll need to consider error conditions i.e. what happens if the API call fails?

Good luck with your project.

1 Like