【问题标题】:Life post Android Mobile Backend Starter? Authentication errorsLife post Android 移动后端启动器?身份验证错误
【发布时间】:2015-03-04 22:42:59
【问题描述】:

我正在挑选去年的一个项目,该项目基于 Google 现已停产的“移动后端启动器”。我相信该应用程序处于工作状态,但是当在谷歌提供的网页上选择“由客户端 ID 保护”设置时,它现在似乎无法通过身份验证。我收到以下错误:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
{
"code": 401,
"errors": [
{
"domain": "global",
"location": "Authorization",
"locationType": "header",
"message": "Unauthenticated calls are not allowed",
"reason": "required"
}
],
"message": "Unauthenticated calls are not allowed"
}

运行此方法导致的错误

private void listPosts(final String alertTxt) {
    // create a response handler that will receive the result or an error
    CloudCallbackHandler<List<CloudEntity>> handler =
            new CloudCallbackHandler<List<CloudEntity>>() {
                @Override
                public void onComplete(List<CloudEntity> results) {
                    //mAnnounceTxt.setText(R.string.announce_success);
                    mAnnounceTxt.setText(alertTxt);
                    mPosts = results;
                    animateArrival();
                    updateGuestbookView();
                }

                @Override
                public void onError(IOException exception) {
                    mAnnounceTxt.setText(R.string.announce_fail);
                    animateArrival();
                    handleEndpointException(exception);
                }
            };
...

我不确定从哪里/如何开始调试它?

【问题讨论】:

  • 你设法让它运行了吗?还能用吗?

标签: android google-app-engine google-cloud-messaging


【解决方案1】:

401 错误通常由以下任一原因引起:

  • 令牌过期
  • 令牌撤销
  • 令牌未授权用于所需范围
  • 请求未通过 OAuth 正确授权

尝试 refreshToken() 解决过期令牌问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多