连接到XMPP服务器时SASL授权失败
我试图通过XMPP服务器使用SMACK API连接到gmail。但得到连接到XMPP服务器时SASL授权失败
错误:使用机制平原
您可以检查代码一瞥SASL认证失败。我从网上只得到它
ConnectionConfiguration connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
connection = new XMPPConnection(connConfig);
connection.connect();
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
我检查了smack调试窗口。它说,在XML:
<无效-authzid />
我已经对Gmail帐户和我的gtalk也运行。
您需要设置验证您连接即
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
connection.connect()
之前必须出现之前。
请参阅我的blog。
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();
}
我也得到这个错误,但我不能工作。
解释错误是什么,并提供对用户提供代码的更正。 SASLAuthentication.supportSASLMechanism(“PLAIN”,0); – 2012-10-11 09:57:24
SASLAuthentication.supportSASLMechanism(“PLAIN”,0);不再可用。 – joao2fast4u 2016-10-17 13:41:51
感谢您的回复它的工作 – SPB 2010-09-20 09:27:24
截至28-11-2013没有工作。 – 2013-11-27 23:48:06
我无法在该类中找到该方法。任何选择? – joao2fast4u 2016-10-17 13:19:39