XMPP服务器不会对用户进行身份验证

时间:2017-04-18 12:14:11

标签: javascript xmpp openfire

使用JS和Strophe创建消息传递应用程序。使用Strophe来处理连接,我似乎无法使用不是管理员的凭据登录。我试图从登录表单中动态地提取它们,这是我能说的。用户已成功登录到api,但未登录到XMPP服务器(托管在OpenFire上)。

尝试使用Pidgin作为代理来测试凭据。管理员帐户登录,但所有其他帐户在端口7070上立即断开连接,并且无法在端口5222中进行身份验证。据我所知,身份验证凭据是正确的。我甚至在飞行中创建了一对并测试了它们,但即使它们出现在OpenFire中并通过ajax调用api登录也无济于事。

Strophe log

Strophe is connecting.
xmpp.js:6 0 : _throttledRequestHandler called with 1 requests
xmpp.js:6 0 : request id 1.0 posting
xmpp.js:6 0 : request id 1.0 state changed to 1
xmpp.js:6 0 : request id 1.1 state changed to 2
xmpp.js:6 0 : request id 1.1 state changed to 3

xmpp.js:6 0 : request id 1.1 state changed to 4
xmpp.js:6 0 : removing request
xmpp.js:6 0 : _throttledRequestHandler called with 0 requests
xmpp.js:6 0 : request id 1 should now be removed
xmpp.js:6 0 : request id 1.1 got 200
xmpp.js:6 1 : _connect_cb was called
xmpp.js:6 0 : _throttledRequestHandler called with 0 requests
xmpp.js:6 0 : _throttledRequestHandler called with 1 requests
xmpp.js:6 0 : request id 2.0 posting
xmpp.js:6 0 : request id 2.0 state changed to 1
xmpp.js:6 0 : request id 2.1 state changed to 2
xmpp.js:6 0 : request id 2.1 state changed to 3
strophe.js:4839 XHR finished loading: POST 

xmpp.js:6 0 : request id 2.1 state changed to 4
xmpp.js:6 0 : removing request
xmpp.js:6 0 : _throttledRequestHandler called with 0 requests
xmpp.js:6 0 : request id 2 should now be removed
xmpp.js:6 0 : request id 2.1 got 200
xmpp.js:6 1 : _dataRecv called
xmpp.js:6 0 : _throttledRequestHandler called with 0 requests
xmpp.js:6 0 : _throttledRequestHandler called with 1 requests
xmpp.js:6 0 : request id 3.0 posting
xmpp.js:6 0 : request id 3.0 state changed to 1
xmpp.js:6 0 : request id 3.1 state changed to 2
xmpp.js:6 0 : request id 3.1 state changed to 3
strophe.js:4839 XHR finished loading: POST 

xmpp.js:6 0 : request id 3.1 state changed to 4
xmpp.js:6 0 : removing request
xmpp.js:6 0 : _throttledRequestHandler called with 0 requests
xmpp.js:6 0 : request id 3 should now be removed
xmpp.js:6 0 : request id 3.1 got 200
xmpp.js:6 1 : _dataRecv called
xmpp.js:21 4
xmpp.js:35 Strophe failed to authenticate.

用户名:s

密码:s

电子邮件:s

const BOSH_SERVICE = 'http://xmpp.sitr.com:7070/http-bind/';
var connection = null;

    Strophe.log = function(level, msg) {
        console.log(level + ' : ' + msg);
    };


function onConnect(status){

    console.log(status);

    if(status==Strophe.Status.CONNECTING){
        console.log('Strophe is connecting.');
        //Strophe.log;
    }else if (status == Strophe.Status.CONNFAIL){
        console.log('Strophe failed to connect.');

    }else if (status== Strophe.Status.DISCONNECTING){
        console.log('Strophe is disconnecting.');

    }else if (status == Strophe.Status.DISCONNECTED){
        console.log('Strophe is disconnected.');
    }else if (status == Strophe.Status.AUTHFAIL){
        console.log('Strophe failed to authenticate.');
    }else if(status == Strophe.Status.CONNECTED){
        console.log('Strophe is connected.');
         $('#notifications').html('<p class="welcome">Hello! Any new posts will appear below.</p>');
        connection.addHandler(notifyUser, null, 'message', null, null,  null);
        connection.send($pres().tree());
    }

}

function XMPP(xmppUser, password, email) {
    //console.log(xmppUser, password, email);

//XMPP is called in global.js in login function. Passes arguments.
    var connection = new Strophe.Connection(BOSH_SERVICE).connect(
                            xmppUser + '@xmpp.site.com',
                            password, 
                            onConnect);

    };  

0 个答案:

没有答案