android中accountManager的getPassword中出现SecurityException
我试图找回谷歌帐户的密码,但得到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我阅读这篇文章,错误是因为配置不匹配。需要你仔细推敲细节
As far as I read this post, the error is because of mismatch configuration. You need to dedug in details
我不认为(这只是猜测)你可以找回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