title: AuthToken from AccountManager in Android Client No Longer Working
body: <p>I'm pretty exasperated. I'm attempting to build a turn-based multiplayer online game for Android using Google App Engine in Java as the server.</p>
  
  <p>They seem like a perfect fit. Android requires a Google account, and GAE uses a Google account for authentication, while being free and scalable.</p>
  
  <p>So before the holidays I was able to get authentication to my GAE app from my Android client using the new AccountManager API in Android 2.0. The following code allows you to access the AuthToken of the user's Google account and then use it for authentication, so that the user does not have to manually enter their account username and password:  </p>
  
  <pre><code>   AccountManager mgr = AccountManager.get(this); 
     Account[] accts = mgr.getAccountsByType("com.google"); 
     Account acct = accts[0];
     AccountManagerFuture&lt;Bundle&gt; accountManagerFuture = mgr.getAuthToken(acct, "ah", null, this, null, null);
     Bundle authTokenBundle = accountManagerFuture.getResult(); 
     String authToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
  </code></pre>
  
  <p>I was then able to append the resulting AuthToken string to the appropriate URL and get a valid cookie which I could then use for all further requests. Only thing is, sometime last week it just stopped working for me. Now when I try to use the AuthToken from the above code, I don't get a cookie returned and my code throws a NullPointerException for the missing cookie.</p>
  
  <p>When I go back to the old way, when the user was manually entering in their Google username and password and I get the AuthToken from "<a href="https://www.google.com/accounts/ClientLogin" rel="nofollow noreferrer">https://www.google.com/accounts/ClientLogin</a>", it works just fine.</p>
  
  <p>Please tell me someone out there has built an Android client for a Google App Engine app using the AuthToken from the Google account on the user's phone, and give me some clue as to why this is no longer working. </p>
  
  <p>I'd really like to make this work. My alternatives are to require the user to enter their credentials (which is clunky, and which they shouldn't have to do), or going with another solution for the server.</p>
  
  <p>Thanks in advance.</p>