On Fri, Nov 23, 2012 at 5:59 PM, Christopher Masser <[email protected]> wrote:
> SOLVED:
> accountManager.invalidateAuthToken(account.type, null); doesn't seem to be
> enough.
> One has to provide the name of the old token instead of null.
> Although the documentation says that the token can be null and it will
> invalidate it for the whole account type.

In recent versions it will actually throw IllegalArgumentException if
the token is
null. All invalidate() does it find the token in the DB and delete it,
so it won't
match if there is no token. Cf. the actual code (from JB 4.2)

        if (authToken == null || accountType == null) {
            return;
        }
        Cursor cursor = db.rawQuery(
                "SELECT " + TABLE_AUTHTOKENS + "." + AUTHTOKENS_ID
                        + ", " + TABLE_ACCOUNTS + "." + ACCOUNTS_NAME
                        + ", " + TABLE_AUTHTOKENS + "." + AUTHTOKENS_TYPE
                        + " FROM " + TABLE_ACCOUNTS
                        + " JOIN " + TABLE_AUTHTOKENS
                        + " ON " + TABLE_ACCOUNTS + "." + ACCOUNTS_ID
                        + " = " + AUTHTOKENS_ACCOUNTS_ID
                        + " WHERE " + AUTHTOKENS_AUTHTOKEN + " = ? AND "
                        + TABLE_ACCOUNTS + "." + ACCOUNTS_TYPE + " = ?",
                new String[]{authToken, accountType});

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to