【问题标题】:Rare exception "android.accounts.AuthenticatorException: ServiceDisabled" - what does this means?罕见异常“android.accounts.AuthenticatorException: ServiceDisabled”——这是什么意思?
【发布时间】:2019-03-05 17:20:09
【问题描述】:

编辑 3(7 月)

问题又回来了!

android.accounts.AuthenticatorException: ServiceDisabled

所以我的电子邮件应用程序无法再连接到 GMail。

有人可以帮忙吗?

谢谢

编辑 2(3 月 7 日)

也许为 Android 创建一个“ID 客户端 OAuth 2.0”正在解决这个问题。 此 ID 必须在此页面上创建 https://console.developers.google.com/apis/credentials

调查正在进行中..


编辑

我认为这与https://wordpress.org/support/topic/be-careful-everybody-who-is-using-oauth-2-0-to-access-gmail-google-gsuite-apis/有关

我应该如何让我的应用获准使用oauth2:https://mail.google.com/ scope


受影响用户的反馈 - 这是造成这种情况的原因吗?

他创建了许多 Google 帐户(做一些测试)。 这是否与创建的 Google 帐户数量过多有关,这些帐户“链接”到他的初始电子邮件地址(使用相同的初始帐户进行恢复)? 错误的假设


我的电子邮件应用程序正在使用 AccountManager 访问 GMail(使用 OAuthToken )并且它工作正常(自 2102 年以来),除了我现在有一个特殊的例外情况仅使用特定的 Google 帐户

这似乎是一个相当新的行为

这里的错误是:

W/System.err: android.accounts.AuthenticatorException: ServiceDisabled
W/System.err:     at android.accounts.AccountManager.convertErrorToException(AccountManager.java:2507)
W/System.err:     at android.accounts.AccountManager.-wrap0(Unknown Source:0)
W/System.err:     at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:2350)
W/System.err:     at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)
W/System.err:     at android.os.Binder.execTransact(Binder.java:697)

问题:

  1. “android.accounts.AuthenticatorException: ServiceDisabled”错误究竟是什么意思?
  2. 到底为什么只有这个 google 帐户才会出现这种情况? (可能还有其他一些,但根据用户的反馈,这似乎真的很少见)。我应该检查此帐户的某些 Android Google 帐户设置吗?哪些?

因此,相同的代码适用于我在手机上测试的大约 10 个帐户,但对于这个非常具体的 Google 帐户却失败了!为什么?

仅供参考,我在这里打开了一个问题:https://issuetracker.google.com/issues/127454208

注意:

据该账号的所有者称,该应用程序之前正在运行,但突然停止运行:我正在调查它何时发生,以及他是否能给我一些关于他当时可能采取的行动的提示。

在此先感谢您的帮助。


我收集的一些信息:

我设法调试了一下,发现堆栈跟踪在 cpp 中走得更远:

jboolean res = env->CallBooleanMethod(mObject, gBinderOffsets.mExecTransact,
        code, (int32_t)&data, (int32_t)reply, flags);

https://android.googlesource.com/platform/frameworks/base/+/f76a50c/core/jni/android_util_Binder.cpp

我发现“res = onTransact(code, data, reply, flags);” (即来自 AIDL 的 android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69))被调用

code = 2 (probably android.accounts.AccountManager.VISIBILITY_USER_MANAGED_VISIBLE = 2)
data : a Parcel Object 
reply : another Parcel Object 
flags = 17

这看起来不错,适用于所有其他 Google 帐户!

我还发现AccountManager.convertErrorToException中的错误码 是代码ERROR_CODE_INVALID_RESPONSE

【问题讨论】:

    标签: android google-authentication accountmanager


    【解决方案1】:

    问题理解并解决!

    自 2019 年 1 月起,some OAuth2 scopes are restricted.
    此外,Additional Requirements for Specific API Scopes 页面状态:

    本节中的要求将于 1 月开始执行 2019 年 1 月 15 日,所有新申请都必须进行新申请 在访问某些 API 范围之前审查流程。应用 2019年1月15日前提交审核,将给予 宽限期达到合规,必须提交重新审查 否 迟于 2019 年 2 月 15 日。要了解有关这些新 要求,阅读我们的博客文章,提升用户对我们 API 的信任 生态系统和 OAuth 应用程序验证常见问题解答。

    为了让您的 Android 应用程序与此兼容,您必须为 Android 创建一个新的“ID 客户端 OAuth 2.0”。

    这个ID必须在这个页面上创建https://console.developers.google.com/apis/credentials

    奇怪的是,这一切似乎都与 G Suite 和 Google API 相关,而不是 Android SDK。
    这可能是因为 Android SDK 的 OAuth 部分在后台使用了 Google API,更准确地说,AccountManager#getAuthToken 方法确实使用了它。

    【讨论】:

    • 嗨,android 的 id 客户端 oauth 是自动创建的,但它不起作用,我删除了它,创建了一个新的但仍然......你认为这可能是时间问题吗?喜欢它需要一些时间才能活跃吗?如果没有,你有什么想法吗?我收到相同的“android.accounts.AuthenticatorException:ServiceDisabled”谢谢
    • 嗨,我认为这取决于您使用的 OAuth 范围。我建议你仔细阅读这个页面support.google.com/cloud/answer/9110914#restricted-scopes ;-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多