Java and Jabber/Smack [closed]

瘦欲@ 提交于 2019-12-21 21:39:29

问题


I am trying to code a simple example using the latest version of Smack (3.2.1) to send and receive messages between two accounts.

Connection connection = new XMPPConnection("jabber.org");
connection.connect();
connection.login("username", "password");

But I can't even get past the login part. When I run the above code I get this exception:

Exception in thread "main" SASL authentication DIGEST-MD5 failed: invalid-authzid: 
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:337)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)
at org.jivesoftware.smack.Connection.login(Connection.java:348)
at com.smack.TestSmack.main(TestSmack.java:19)

What is going on here? I am sure my username and password work because I can log in using my IM client.

And can anyone point me to current working Smack examples? This is very frustrating because the documentation and the library seem out of sync.

Thanks-


回答1:


Could you check that you are not adding "@jabber.org" at the end of the username? if you do, it will not work.

Otherwise, if you do that already, you may want to try using

SASLAuthentication.supportSASLMechanism("PLAIN", 0);

before

connection.login("username", "password");



来源:https://stackoverflow.com/questions/6659215/java-and-jabber-smack

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!