I am trying to configure a Java server to communicate with Google Cloud Connection Server using the smack library. I installed the application key and the API key through the Google API and am trying to use the following code:
import javax.net.ssl.SSLSocketFactory; import org.jivesoftware.smack.Connection; import org.jivesoftware.smack.ConnectionConfiguration; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.SASLAuthentication; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Packet; public class CloudMessager { public CloudMessager(){ ConnectionConfiguration config = new ConnectionConfiguration("gcm.googleapis.com", 5235); SASLAuthentication.supportSASLMechanism("PLAIN", 0); config.setSASLAuthenticationEnabled(true); config.setSocketFactory(SSLSocketFactory.getDefault()); Connection connection = new XMPPConnection(config);
Which gives me the following error:
SASL authentication PLAIN failed: text: at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:342) at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:221) at org.jivesoftware.smack.Connection.login(Connection.java:366) at org.umptyfratz.strongbox.CloudMessager.<init>(CloudMessager.java:25)
I’ll lose a little to figure out where to go from here. Has anyone else successfully connected to CCS using the Java smack library?
source share