Hi I'm having issues recovering my authToken when I call
mAccountManager.blockingGetAuthToken(Auth.getAccount(), Auth.AUTH_TOKEN_TYPE, true)
I get a null string back, which lead me to look into my AbstractAccountAuthenticator class, specifically getAuth(). Here's what its doing:
public Bundle getAuthToken(AccountAuthenticatorResponse response,
Account account, String authTokenType, Bundle options)
throws NetworkErrorException {
final AccountManager am = AccountManager.get(mContext);
String authToken = am.peekAuthToken(account, authTokenType);
String uid = am.getUserData(account, AccountManager.KEY_CALLER_UID);
// return bundle with authToken
if (!TextUtils.isEmpty(authToken)) {
final Bundle result = new Bundle();
result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
result.putString(AccountManager.KEY_AUTHTOKEN, authToken);
result.putString(AccountManager.KEY_CALLER_UID, uid);
return result;
}
return null;
}
The peekAuthToken is returning a null, however I am getting the correct uid
from getUserData which lead me to believe I am adding the account correctly. This is how I set the authToken:
mAccountManager.addAccountExplicitly(account, accountPassword, extraData);
//The addAccount is working, and I can obtain the extraData in getAuth
mAccountManager.setAuthToken(account, Auth.AUTH_TOKEN_TYPE, authtoken);
//I assume this is where the authToken is to be cached…but I can't retrieve it…
//The token does exist at this point
Any suggestions?