2

I have extended AbstractAccountAuthenticator and overridden getAuthToken. Everything works well with my getAuthToken except when the cached authtoken is valid, in which case the AccountManagerCallback (signinCallback) is called without my getAuthToken being called. This is a problem because my getAuthToken loads up the return bundle with app specific data.

This is the account manager call I use:

`signinFuture = mAM.getAuthToken(account, getApplicationContext().getString(R.string.ACCOUNT_TYPE), null, SignInFragmentActivity.this, signinCallback, null);`

Is this what you'd expect or should account manager getAuthToken always call my authenticator overrides? what am I doing wrong?

Alex
  • 57
  • 5

1 Answers1

1

A little late, but documenting this answer since I was looking for something similar via a Google search which brought me here.

A closer study of the Android documentation makes clear that getAuthToken is only supposed to return three sets of keys (depending on the outcome of the call)

The right approach is to store your app-specific data in the UserData bundle when you explicitly create an account using the AccountManager and retrieve it once you have a valid auth token.

See http://developer.android.com/reference/android/accounts/AccountManager.html for further reference.

Jin Hian Lee
  • 173
  • 1
  • 4