I am very annoyed. I am trying to create a turn-based multiplayer online game for Android using the Google App Engine in Java as a server.
They seem perfect. Android requires a Google account, and GAE uses a Google account for authentication, being free and scalable.
So, before the holidays, I was able to get authentication in my GAE application from my Android client using the new AccountManager API in Android 2.0. The following code allows you to access the AuthToken Google user account and then use it for authentication so that the user does not have to manually enter the user name and password of the account:
AccountManager mgr = AccountManager.get(this); Account[] accts = mgr.getAccountsByType("com.google"); Account acct = accts[0]; AccountManagerFuture<Bundle> accountManagerFuture = mgr.getAuthToken(acct, "ah", null, this, null, null); Bundle authTokenBundle = accountManagerFuture.getResult(); String authToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
Then I was able to add the resulting AuthToken string to the corresponding URL and get a valid cookie, which I could then use for all subsequent requests. The only thing is that last week it just stopped working for me. Now, when I try to use AuthToken from the above code, I don't get a cookie, and my code throws a NullPointerException for the missing cookie.
When I go back to the old way, when the user manually entered the Google username and password, and I get AuthToken from https://www.google.com/accounts/ClientLogin ", it works fine.
Please tell me, someone built an Android client for the Google App Engine application there using AuthToken from the Google account on the user's phone, and let me know why this does not work anymore.
I would really like to do this job. My alternatives require the user to enter their credentials (which is inconvenient, and what they donβt need to do), or is going with another server solution.
Thanks in advance.
android authentication google-app-engine accountmanager
polyclef Jan 03 '09 at 23:01 2010-01-03 23:01
source share