SASL authorization error while connecting to XMPP server

I am trying to connect to gmail using the SMACK API through an XMPP server. but getting

error: SASL authentication error using the PLAIN mechanism

you can check the code. I only got it from the network.

ConnectionConfiguration connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com"); connection = new XMPPConnection(connConfig); connection.connect(); SASLAuthentication.supportSASLMechanism("PLAIN", 0); 

I checked in the smack debug window. he says in XML:

<invalid-authzid / ">

I already have a gmail account and my gtalk also works.

+4
source share
2 answers

Before connecting, you need to set authentication

SASLAuthentication.supportSASLMechanism("PLAIN", 0);

should appear before connection.connect() .

Watch the blog.

+9
source
  ConnectionConfiguration cc = new ConnectionConfiguration( "vietnam.agilemobile.com", 5222, vietnam.agilemobile.com"); XMPPConnection connection = new XMPPConnection(cc); try { SASLAuthentication.supportSASLMechanism("PLAIN", 0); connection.connect(); Log.e("LOGIN", "" + 111); // You have to put this code before you login Log.e("LOGIN", "" + 222); // You have to specify your gmail addres WITH @gmail.com at the end connection.login("nemodo", "123456", "resource"); Log.e("LOGIN", "" + 333); // See if you are authenticated System.out.println(connection.isAuthenticated()); } catch (XMPPException e1) { e1.printStackTrace(); } 

I also get this error, but I cannot work.

+1
source

All Articles