title: Android getAuthToken returns a null token
body: <p>Well i need to authorize Google Calendar's access for a user, first google Id works fine when i use      </p>
  
  <pre><code>blockingGetAuthToken
  </code></pre>
  
  <p>and it gets a token, i usually log on this token.
  So when i tried to use other accounts i got a null token.
  I searched a lot and found out that using <code>getAuthToken</code> is preferred as it uses a context from the activity calling it.. then i converted the whole process to use it </p>
  
  <pre><code> private static final String AUTH_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/calendar";
  
  public static String authorize(AndroidtestActivity parent, Account account) {
      AccountManager accountManager = AccountManager.get(parent);
      Bundle options= new Bundle();
  
      Log.d("MyAPP", "Get Authorization");
      try {
          AccountManagerFuture&lt;Bundle&gt; acc=accountManager.getAuthToken ( account, AUTH_TOKEN_TYPE,  options, true, null, null);
          Bundle authTokenBundle = acc.getResult();
          String authToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
  
          Log.d("MyAPP","Token= "+authToken);
          return authToken;
  
  
      } catch (Exception ex) {
          Logger.getLogger(GoogleAuthorize.class.getName()).log(Level.SEVERE,
                  null, ex);
      }
      return null;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>but still no accounts could get a valid token, they all get a null one</p>
  
  <p>then i saw this answer <a href="https://stackoverflow.com/a/2021337/1280902">https://stackoverflow.com/a/2021337/1280902</a>  and followed using <code>invalidateAuthToken</code> </p>
  
  <pre><code>private static final String AUTH_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/calendar";
  
  public static String authorize(AndroidtestActivity parent, Account account) {
      AccountManager accountManager = AccountManager.get(parent);
      Bundle options= new Bundle();
  
      Log.d("MyAPP", "Get Authorization");
      try {
          AccountManagerFuture&lt;Bundle&gt; acc=accountManager.getAuthToken ( account, AUTH_TOKEN_TYPE,  options, true, null, null);
          Bundle authTokenBundle = acc.getResult();
          String authToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
          accountManager.invalidateAuthToken("com.google",authToken);
          acc=accountManager.getAuthToken ( account, AUTH_TOKEN_TYPE,  options, true, null, null);
          authTokenBundle = acc.getResult();
          authToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
  
          Log.d("MyAPP","Token= "+authToken);
          return authToken;
  
  
      } catch (Exception ex) {
          Logger.getLogger(GoogleAuthorize.class.getName()).log(Level.SEVERE,
                  null, ex);
      }
      return null;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>but i had the same problem on every account i use, even the one that used to work at the beginning with <code>blockingGetAuthToken</code></p>
  
  <p>So am i missing something?</p>