Take the 2-minute tour ×

I am writing a GMail client for Android. I want to list all GMail accounts in a ListView. When the user clicks one item, I want the program to retrieve the password of the corresponding account.

However, I get a SecurityException:

java.lang.SecurityException: caller uid 10107 is different than the authenticator's uid

This is my code:

AccountManager accountManager = AccountManager.get(context);

this.username = account.name;
this.password = accountManager.getPassword(account); //this is where I get the exception

I have all these permissions in AndroidManifest.xml:

<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"></uses-permission>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"></uses-permission>

According to Android reference, the only permission needed should be MANAGE_ACCOUNTS.

What is the problem of my code?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

You can get an authtoken, but you can't get the users actual credentials. The actually creditials are only accessible by the application that created them. From the documentation of the getPassword method (emphasis mine):

This method requires the caller to hold the permission AUTHENTICATE_ACCOUNTS and to have the same UID as the account's authenticator.

share|improve this answer
Sounds good to know this. I think I'm more safe right now. Thanks Kurtis. –  b101101011011011 Oct 3 '11 at 19:41
add comment

Your Answer


