AnsweredAssumed Answered

asmack-android-8-4.0.6: SASLError using DIGEST-MD5: not-authorized

Question asked by mr.boyfox on Jan 15, 2015

Hi,

I get following error while login after successfully connecting:

 

 

01-15 20:44:07.448  30164-30196/com.stm.myjob E/XMPPService Failed to log in as 8b6c219c36578e893c5e6d1d7b5af8a

01-15 20:44:07.448  30164-30196/com.stm.myjob E/XMPPService org.jivesoftware.smack.sasl.SASLErrorException: SASLError using DIGEST-MD5: not-authorized

01-15 20:47:07.891  30164-30223/com.stm.myjob W/PacketWriter Exception writing closing stream element

    java.net.SocketException: sendto failed: EPIPE (Broken pipe)

            at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:546)

            at libcore.io.IoBridge.sendto(IoBridge.java:515)

            at java.net.PlainSocketImpl.write(PlainSocketImpl.java:504)

            at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:37)

            at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266 )

            at java.io.OutputStreamWriter.flushBytes(OutputStreamWriter.java:167)

            at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:158)

            at java.io.BufferedWriter.flush(BufferedWriter.java:124)

            at org.jivesoftware.smack.tcp.PacketWriter.writePackets(PacketWriter.java:190)

            at org.jivesoftware.smack.tcp.PacketWriter.access$000(PacketWriter.java:40)

            at org.jivesoftware.smack.tcp.PacketWriter$1.run(PacketWriter.java:77)

     Caused by: android.system.ErrnoException: sendto failed: EPIPE (Broken pipe)

            at libcore.io.Posix.sendtoBytes(Native Method)

            at libcore.io.Posix.sendto(Posix.java:176)

            at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)

            at libcore.io.IoBridge.sendto(IoBridge.java:513)

            at java.net.PlainSocketImpl.write(PlainSocketImpl.java:504)

            at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:37)

            at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266 )

            at java.io.OutputStreamWriter.flushBytes(OutputStreamWriter.java:167)

            at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:158)

            at java.io.BufferedWriter.flush(BufferedWriter.java:124)

            at org.jivesoftware.smack.tcp.PacketWriter.writePackets(PacketWriter.java:190)

            at org.jivesoftware.smack.tcp.PacketWriter.access$000(PacketWriter.java:40)

            at org.jivesoftware.smack.tcp.PacketWriter$1.run(PacketWriter.java:77)

 

I open user on OpenFire server, user name 8b6c219c36578e893c5e6d1d7b5af8a@myjob.uz. If I use asmack-2010.05.07 all works fine, but when using asmack-android-8-4.0.6 I get following error.\

Anybody know how to fix it?

 

 

Here Connect method:

 

private void connect(final String login, final String password) {

        Thread t = new Thread(new Runnable() {

            @Override

            public void run() {

                // Create a connection

                ConnectionConfiguration connConfig = new ConnectionConfiguration(

                        AppConfig.XMPP_HOST, AppConfig.XMPP_PORT, AppConfig.XMPP_SERVICE);

                connConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

 

                XMPPConnection connection = new XMPPTCPConnection(connConfig);

 

                try {

                    HLog.i(TAG, "XMPP connecting ...");

                    connection.connect();

                    HLog.i(TAG,

                            "Connected to " + connection.getHost());

                } catch (XMPPException ex) {

                    HLog.e(TAG, "Failed to connect to "

                            + connection.getHost());

                    HLog.e(TAG, ex.toString());

                    setConnection(null);

                } catch (SmackException e) {

                    e.printStackTrace();

                } catch (IOException e) {

                    e.printStackTrace();

                }

                try {

                    // SASLAuthentication.supportSASLMechanism("PLAIN", 0);

                    connection.login(AppConfig.TEST_USERNAME, AppConfig.TEST_PASSWORD);

                    HLog.i(TAG,

                            "HLogged in as " + connection.getUser());

                } catch (XMPPException ex) {

                    HLog.e(TAG, "Failed to log in as "

                            + login);

                    HLog.e(TAG, ex.toString());

                    setConnection(null);

                } catch (SmackException sexp) {

                    sexp.printStackTrace();

                } catch (IOException ioexp) {

                    ioexp.printStackTrace();

                }

            }

        });

        t.start();

    }

Outcomes