Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

asmack-android-8-4.0.2 Sasl-error

$
0
0

I am developing a im app in Android with Open Fire as my xmpp server. I am having trouble with logging into the server (SASLError using PLAIN: not-authorized) with Moto-G devices and not with all other devices. I am using asmack-android-8-4.0.2.jar library and following is my code for logging in.

 

ConnectionConfiguration conConFig;

XMPPConnection localConnection = null;

SmackConfiguration.DEBUG_ENABLED = true;

        Roster.setDefaultSubscriptionMode(SubscriptionMode.accept_all);

SASLAuthentication.supportSASLMechanism("PLAIN", 0);

SmackAndroid.init(context);

conConFig = new ConnectionConfiguration(host,

                       port);

        conConFig

                .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

conConFig.setCompressionEnabled(false);

//I think this wont make any effect since I set SecurityMode.disabled

conConFig.setCustomSSLContext(createContext());

 

localConnection = new XMPPTCPConnection(conConFig);

        localConnection.connect();

localConnection.login(username, password);

 

 

     public static SSLContext createContext() throws KeyStoreException,

            NoSuchAlgorithmException, KeyManagementException {

        KeyStore trustStore;

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {

            trustStore = KeyStore.getInstance("AndroidCAStore");

        } else {

            trustStore = KeyStore.getInstance("BKS");

        }

 

        TrustManagerFactory trustManagerFactory = TrustManagerFactory

                .getInstance(KeyManagerFactory.getDefaultAlgorithm());

        trustManagerFactory.init(trustStore);

        SSLContext sslContext = SSLContext.getInstance("TLS");

        sslContext.init(null, trustManagerFactory.getTrustManagers(),

                new SecureRandom());

        return sslContext;

     }

 

Foloowing is the error trace....

<stream:stream to="server" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">

<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="shaili" id="d3136cce" xml:lang="en" version="1.0">

<stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mech anism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mech anism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>

<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">ACs5MTk1OTcxNjk2OTIAKzkxOTU5NzE2OTY5Mg ==</auth>

<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>

 

org.jivesoftware.smack.sasl.SASLErrorException: SASLError using PLAIN: not-authorized

at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java: 342)

at org.jivesoftware.smack.tcp.XMPPTCPConnection.login(XMPPTCPConnection.java:244)

at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:442)

 

 

 

 

 

 



Viewing all articles
Browse latest Browse all 10742

Trending Articles