I am seeking a method to programmatically automate the login process using pre-known credentials in my Android client application that uses a WebView to access a Jitsi conference server configured for LDAP authentication.
Currently in my application, after manually entering the conference room name, I encounter an authentication dialog with username and password fields, and connect and cancel buttons.
If I manually enter my login information (username and password), everything works fine, and I can connect to the conference.
However, as I said, my initial goal was, after loading this login page, to automatically populate these fields with the credentials (since they are known in advance by my application) and automatically click the connect button. I tried to execute some JS code like :
document.querySelector('input[name="password"]').value = '$password';
const connexionButton = document.getElementById('modal-dialog-ok-button');
connexionButton.removeAttribute('disabled');
connexionButton.className = 'css-172al4i-button-primary-small';
connexionButton.click();
But due to some React mechanisms that I don't fully understand, it seems that the injected credentials are not actually being considered, and when I click the button, nothing happens (except error messages popping up in the console indicating that the password is required).
The second solution I tried was the Jitsi Meet SDK by attempting to start a conference with 'JitsiMeetActivity.launch(…)'. However, I realized that only a JWT token can be specified in the options, and not a password (which may indeed be safer). But the Jitsi server I need to communicate with does not have JWT token authentication enabled, as it uses LDAP instead. So, I abandoned that solution.
I even thought about simulating user gestures, and realized that it's a very complex (and not subtle at all) solution for something that should be straightforward.
Returning to the 'WebView' approach, I even tried to perform the same manipulation on a Chrome browser by executing JavaScript code in the console, but I kept failing in the same way. I observed the connection stack trace (LoginDialog.tsx -> connection.js -> JitsiConnection.js -> xmpp.js XmppConnection.js -> strophe.stream-management.js -> strophe.umd.js).
I tried calling connection functions like connect(id, password, roomName), but I couldn't reach them.
In my application, I also tried to mimic the authentication mechanism using a WebSocket to send username and password with the same xmpp message format. To my surprise, I received a 'success' response! But then I realized that the rest of the exchange protocol was too long and complex to complete and implement this system properly.
So, I'm reaching out for help and asking what the most efficient way is to programmatically authenticate through a web interface (since the SDK solution doesn't seem ready for LDAP), using username and password, even if it requires executing as much JavaScript code as necessary.
Thanks !