Login exception SASL authentication failed using mechanism DIGEST-MD5 asmack in android

Kasun Dev picture Kasun Dev · Apr 4, 2013 · Viewed 17.2k times · Source

I m try to connect with Xmpp server,But i m getting exception

Login exception SASL authentication failed using mechanism DIGEST-MD5

i use this code ,can any one help me,or code

  try {
        if (xmppConnection == null) {
            ConnectionConfiguration config = new ConnectionConfiguration(
                    SERVER_HOST, SERVER_PORT, SERVICE_NAME);
            xmppConnection = new XMPPConnection(config);
            System.out.println("xmppConnection"+xmppConnection);
        }

        if (!xmppConnection.isConnected()) {
            xmppConnection.connect();
            System.out.println("Connecting");
        }

        System.out.println("facebook id get xmpp "+username);

        if (!xmppConnection.isAuthenticated()) {
            xmppConnection.login(username, "123");
            System.out.println("User is authenticated ");

        }
        Presence presence = new Presence(Presence.Type.available);
        xmppConnection.sendPacket(presence);
                 } catch (Exception e) {
        System.out.println("Login exception "+e);
        e.printStackTrace();
    } 

Answer

Dhaval Parmar picture Dhaval Parmar · May 23, 2013

In the Openfire configuration it is machinename.domain.com

This SASL mechanism uses also the Xmpp Domain name for authentication, not only username and password. This is why authentication fails.

mean your username & password must be like:

username: [email protected] (whatever your domain name)

password: abcabc111

for more detail check this conversation.