Reputation: 14594
When invalidating authorized tokens from AccountManager
using invalidateAuthToken
,
Q1: Why does the function requires the Type
of the account when using the Name
of the account seems to make more sense?
Q2: By giving it the Type
, does invalidateAuthToken
wipe out all auth tokens under that account type?
Upvotes: 5
Views: 1592
Reputation: 9564
Q1: type is not as restrictive as name, it implicitly indicates that you are dealing with a group and not an individual, IMHO.
accountType defines what type of account you are fetching in the accountManager. for example: "www.google" for google accounts. given a bundle inside a callback, you find out the accountType by using:
private class GetAuthTokenCallback implements AccountManagerCallback<Bundle> {
public void run(AccountManagerFuture<Bundle> result) {
try {
bundle = result.getResult();
String auth_token = bundle.getString(AccountManager.KEY_AUTHTOKEN);
String auth_account_type = bundle.getString(AccountManager.KEY_ACCOUNT_TYPE);
Q2: according to the developers guide, the syntax is:
public void invalidateAuthToken (String accountType, String authToken)
accountType must NOT be null, but authToken may be null. if you omit authToken, you clear all tokens for that accountType
Upvotes: 2