开发者

SecurityException in getPassword of accountManager in android

I'm trying to retrieve the password of google account, but getting security exception at String pwd = AccountManager.get(mContext).getPassword(account). Also i have given permissions in androidManifest.xml to account_manager, aunthenticator, get_account, manage account.

code :

android.accounts.Account[] gaccounts = AccountManager.get(mContext).getAccounts();
Log.i("parul", "2222()len :"+ gaccounts.length);
for (android.accounts.Account account: gaccounts) {
   String pwd = AccountManager.get(mContext).getPassword(account);
   Log.i("parul", "google pwd: " + pwd);
   AccountManager.get(mContext).setPassword(account, null);
   String pwdcleared = AccountManager.get(mContext).g开发者_开发知识库etPassword(account);
   Log.i("parul", "google pwdcleared: " + pwdcleared);
}

=============================================================================

Exception:

08-04 06:38:30.821: WARN/AccountManagerService(2248): caller uid 1000 is different than the authenticator's uid

08-04 06:38:30.821: INFO/parul(2804): exception thrown for account manager try block

08-04 06:38:30.821: WARN/System.err(2804): java.lang.SecurityException: caller uid 1000 is different than the authenticator's uid

08-04 06:38:30.821: WARN/System.err(2804): at android.os.Parcel.readException(Parcel.java:1218)

08-04 06:38:30.821: WARN/System.err(2804): at android.os.Parcel.readException(Parcel.java:1206)

08-04 06:38:30.821: WARN/System.err(2804): at android.accounts.IAccountManager$Stub $Proxy.getPassword(IAccountManager.java:397)

08-04 06:38:30.821: WARN/System.err(2804): at android.accounts.AccountManager.getPassword(AccountManager.java:157)

=============================================================================

If anybody is aware why i'm getting this problem plz help. Thanks


As far as I read this post, the error is because of mismatch configuration. You need to dedug in details


I don't think (it is only a guess) you can retrieve Google account password. BTW, if you need Google account password to validate user at your service, I suggest another way to do this. Get user's token and pass it to server over secured channel.

See details in my answer here: User authentication at your service by using AccountManager token

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜