AccountManager.confirmCredentials问题

Ora*_*nge 6 authentication android google-login accountmanager google-play-services

我正在尝试使用AccountManager.confirmCredentials方法在我的应用程序中进行用户验证。我正在这样使用它:

    AccountManager am = AccountManager.get(ctx);
    am.confirmCredentials(account, null, ctx, new AccountManagerCallback<Bundle>() {
        @Override
        public void run(AccountManagerFuture<Bundle> amf) {
            try {
                Bundle b = amf.getResult();
                boolean r = b.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);
                vc.onValidateResult(r);
                return;
            } catch (OperationCanceledException ignore) {
            } catch (AuthenticatorException ignore) {
            } catch (IOException ignore) {
            }
            vc.onValidateResult(false);
        }
    }, null);
Run Code Online (Sandbox Code Playgroud)

但是从Android 5开始,在实施方面就出现了差距。用户可以在Google授权表单中清除建议的帐户名,然后使用自己的帐户名。结果将是肯定的,并且无法验证所请求的帐户名是否用于确认,因为获取的包仅具有时间戳和结果布尔值。换句话说,bundle没有KEY_ACCOUNT_NAME字段,但是,根据其应有的引用。

有谁知道如何解决此漏洞?

Ora*_*nge 0

谷歌已经修复了这个问题。现在可以按预期工作,无需更改代码。