Get gtalk XMPP authentication token from android AccountManager

I have a SASL engine configured to respond to X-GOOGLE-TOKEN.

I also have an AccountManager and an account that I want to use from the device.

Now I call the getAuthToken method as follows to get the token:

accountManager.getAuthToken(account, "talk", null, this,
            new AccountManagerCallback<Bundle>() {...});

And he offers me to allow the application access to Google Talk.

Then I send it like this:

"<auth mechanism="X-GOOGLE-TOKEN">" + "\0" + user@gmail.com + "\0" + token + "</auth>"

However, Google then responds with an authentication error ... So I have to request the token incorrectly ... Or maybe the token I receive is for OAUTH?

If this is for OAUTH, is there any preliminary SASLMechanism for this? If so, where can I get the Google API key to use the android token I need, or do I need it?

+3
source

All Articles