Question

I'm learning XMPP Based on Strophe.js and openfire server, because I need it in a future project.

I've configured my openfire admin account, mysql database, the Bosh Protocol and URL for http binding.

I created my first example, here's the html (I included all js files I need in the html header like strophe.js, flXHR.js and strophe.flXHR.js):

<ul>
    <li>JID : <input type="text" name="jid" id="jid" /></li>
    <li>PASS : <input type="password" name="password" id="password"/></li>
    <li><input type="button" value="connect" id="connect" name="Connect" /></li>
</ul>

And this is the javascript code :

$(document).ready(function(){

      connection=null;
      $('#connect').click(function (ev) {
            var jid=$('#jid').val();
            var pass=$('#password').val();

       var conn = new Strophe.Connection("http://127.0.0.1:2580/http-bind/");
       conn.connect(jid, pass, function (status) {
                  console.log(status);
           });
       connection = conn;
    });
});

When I test the code, I type my openfire server username and password (admin,123)... click "connect" and waiting.

The console.log shows the following status values:

1 (connecting)
3 (authenticating)
5 (connected)

To this point, everything is good... But when I type other values different than my admin username and pass, it gives me the same status results?

That means, the connection is established whatever is the input username and pass !!!

What's wrong?

Was it helpful?

Solution

I think I finally solved a part of the problem, I went to server > server settings > registration & login , and disabled Anonymous Login.

What I did before, is going to server > server manager > system properties, and set xmpp.auth.anonymous to false.

And now, another problem raised, no user can log in... the js code in the first post shows now these status messages :

  1 (connecting)
    2 (connection failed)
    7 (disconnecting)
    6 (disconnected)

It seems things get worse after disabling annonymous login. It seems that :

1- Before disabling Anonymous Login: Every user (even with incorrect jid or pass) can authenticate and get connected to the server.

2- After disabling Anonymous Login : Strophe can't even connect to the server.

Any idea?

Edit

I found what's wrong. when testing: I was typing the username, and not the username@server combination (which is the default user jid)... I thought the jid is the username. problem solved

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top