android中accountManager的getPassword中出现SecurityException

发布于 2024-09-12 23:46:33 字数 1647 浏览 1 评论 0原文

我试图找回谷歌帐户的密码,但得到 String pwd = AccountManager.get(mContext).getPassword(account) 处出现安全异常。 我还在 androidManifest.xml 中授予了权限 account_manager、authenticator、get_account、管理帐户。

代码:

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).getPassword(account);
   Log.i("parul", "google pwdcleared: " + pwdcleared);
}

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

异常:

08-04 06:38:30.821:警告/AccountManagerService(2248):呼叫者uid 1000 不同

与身份验证器的 uid 08-04 06:38:30.821 :INFO/parul(2804):为帐户抛出异常 经理尝试块

08-04 06:38:30.821: WARN/System.err(2804): java.lang.SecurityException: 调用者 uid 1000 与 验证者的 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): 在 android.os.Parcel.readException(Parcel.java:1206)

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

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

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

如果有人知道我为什么会这样这个问题请帮忙。 谢谢

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).getPassword(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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

舟遥客 2024-09-19 23:46:33

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

不羁少年 2024-09-19 23:46:33

我不认为(这只是猜测)你可以找回Google帐户密码。
顺便说一句,如果您需要 Google 帐户密码来验证您的服务中的用户,我建议您使用另一种方法。获取用户的令牌并将其通过安全通道传递到服务器。

请参阅我的回答中的详细信息:
使用 AccountManager 令牌在您的服务中进行用户身份验证

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文