SASL authentication failed using mechanism PLAIN ?

778 views
Skip to first unread message

Dirk Dinger

unread,
Jun 21, 2013, 9:00:45 AM6/21/13
to andro...@googlegroups.com
Hi GCM users,

Just started experimenting with CCS als described here http://developer.android.com/google/gcm/ccs.html

Since our server backend is written in Java, I tried to implement the given python example in Java using the Smack library.

I can connect sucessfully to the GCM endpoint with the following code:

        ConnectionConfiguration config = new ConnectionConfiguration("gcm.googleapis.com", 5235);
        config.setSASLAuthenticationEnabled(true);
        config.setSocketFactory(SSLSocketFactory.getDefault());
        config.setDebuggerEnabled(true);
       
        SASLAuthentication.supportSASLMechanism("PLAIN", 0);
        XMPPConnection conn = new XMPPConnection(config);
        conn.connect();

but when I try to authenticate:

            conn.login(<project_id>, <browser_api_key>);

I get the following exception:

Exception in thread "main" SASL authentication failed using mechanism PLAIN:
    at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:325)

What am I doing wrong ?

The username must be the project Id, something like "123645436" right ? or is it "1236...@gcm.googleapis.com"
The browser or server API keys should work both, right ?

Any help appreciated,
Regards,
Dirk



Reply all
Reply to author
Forward
0 new messages