简体   繁体   English

Smack 3.2.2 SASL身份验证DIGEST-MD5失败:无效身份验证

[英]Smack 3.2.2 SASL authentication DIGEST-MD5 failed: invalid-authzid

I have big problem. 我有大问题。 Every time when I'm trying to connect to any jabber server I have got "SASL authentication DIGEST-MD5 failed" notification. 每次尝试连接到任何jabber服务器时,都会收到“ SASL认证DIGEST-MD5失败”的通知。 I dont have this error when I dont use JPasswordField, but using JTextField in IM is pointless. 当我不使用JPasswordField时,我没有此错误,但是在IM中使用JTextField是没有意义的。 I have tried every method I found, but it's all thesame. 我尝试了所有发现的方法,但是都一样。

The code: 编码:

private void bLoginAction(JTextField login, JPasswordField pass) {
loginText = login.getText();
passText = pass.getPassword().toString();
String[] data = loginText.split("@");
Connection.DEBUG_ENABLED = true;
ConnectionConfiguration config = new ConnectionConfiguration(data[1], 5222);
Connection con = new XMPPConnection(config);
 try {
 con.connect();
 } catch (XMPPException e) {
 e.printStackTrace();
 }
try {
 con.login(loginText, passText);
 } catch (XMPPException e) {
 e.printStackTrace();
 }  
}

Print from printStackTrace(): 从printStackTrace()打印:

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) SASL身份验证DIGEST-MD5失败:无效身份验证:在org.jivesoftware的org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)的org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:337)。 smack.Connection.login(Connection.java:348)

Don't use toString() . 不要使用toString() Try using getPassword() instead as shown here . 尝试使用getPassword来(),而不是如图所示这里 Even with a JTextField, you should be using getText() instead of toString() . 即使使用JTextField,也应该使用getText()而不是toString()

This is not a smack issue but a straight up Java one. 这不是一个简单的问题,而是一个简单的Java问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM