使用Smack集成Facebook聊天时,SASL身份验证失败 [英] SASL Authentication failed while integrating facebook chat using Smack
问题描述
我正在尝试使用smack API集成facebook聊天.但是我收到一条错误消息,提示使用摘要md5验证失败...
I am trying to integrate facebook chat using smack API.But i get an error telling authentication failed using digest md5...
以下是用于验证的代码:
Here s the code for authentication:
SASLAuthentication.registerSASLMechanism("DIGEST-MD5", SASLDigestMD5Mechanism.class);
SASLAuthentication.supportSASLMechanism("DIGEST-MD5", 0);
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com",5222);
connection = new XMPPConnection(config);
config.setSASLAuthenticationEnabled(true);
connection.connect();
connection.login(userName, password);
以下是我在运行该错误时遇到的错误:
below is the error i get wen i run it:
Exception in thread "main" SASL authentication failed using mechanism DIGEST-MD5:
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:325)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:395)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)
at JabberSmackAPIFacebook.login(JabberSmackAPIFacebook.java:31)
at JabberSmackAPIFacebook.main(JabberSmackAPIFacebook.java:77)
我可以成功连接到gtalk,但是没有成功vit fb ... 可以打电话给我解决问题
I can successfully connect to gtalk but am having no success vit fb... can sumone tel me wat s the problem
推荐答案
对我来说,解决方案是在不使用DNS SRV调用login()
时不在主机名中包含主机部分. Google Talk服务.这也是
For me the solution was to not include the host part in the username when calling login()
without DNS SRV and not agains the Google Talk services. This is also described in the ignite forums.
例如
connection.login("user@jabber.org", "password", "resource");
成为
connection.login("user", "password", "resource");
这篇关于使用Smack集成Facebook聊天时,SASL身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!