SASL Genehmigung versagt, während auf XMPP-Server verbunden
-
03-10-2019 - |
Frage
Ich versuche, gmail mit SMACK API über XMPP-Server zu verbinden. aber immer die
Fehler: SASL Authentifizierung fehlgeschlagen Mechanismus PLAIN mit
Sie können einen Blick auf Code überprüfen. Ich habe es von Netz nur
ConnectionConfiguration connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
connection = new XMPPConnection(connConfig);
connection.connect();
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
checkte ich im Klaps Debug-Fenster. heißt es in XML:
Ich habe bereits Konto auf gmail und meine gtalk wird auch ausgeführt wird.
Lösung
Sie müssen die Authentifizierung festlegen, bevor Sie eine Verbindung nämlich
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
vor connection.connect()
erscheinen.
Sehen Sie mein bloggen .
Andere Tipps
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();
}
Ich habe auch diesen Fehler, aber ich kann nicht arbeiten.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow