【问题标题】:Facebook - Error Code - 2500 Inactive Access TokenFacebook - 错误代码 - 2500 非活动访问令牌
【发布时间】:2015-12-27 12:55:09
【问题描述】:

我使用 Parse(由 Facebook)作为我的后端服务,并且我已将 Facebook 与现有 Parse 用户链接。

我在与 Facebook 链接的 ParseUser 上使用以下代码

  accessToken = AccessToken.getCurrentAccessToken();
  Log.d("Access Token",accessToken.getToken());

   new GraphRequest(
            accessToken,"/me?fields=first_name,last_name",null,
            HttpMethod.GET,
            new GraphRequest.Callback(){

                public void onCompleted(GraphResponse graphResponse){

                    if(graphResponse.getError()!=null)
                        Log.d("Error", graphResponse.getError().toString());

                    else{
                        try{
                            JSONObject jsonObject = graphResponse.getJSONObject();
                            ParseUser user = ParseUser.getCurrentUser();

                            user.put("email",jsonObject.getString("email"));
                            user.saveInBackground();

                        }catch(JSONException e){
                            e.printStackTrace();
                        }
                    }
                }
            }
    ).executeAsync();

现在在我的日志中,我得到了一个访问令牌,当在 developers.facebook.com/tools/explorer/ 上使用它时 -> 它在那里工作得很好

在我的日志中,我收到以下 错误 -> "{HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: 必须使用活动访问令牌来查询有关当前的信息用户。}"

这完全令人沮丧。我正在使用相同的令牌来访问我的信息,它工作得很好。

【问题讨论】:

    标签: android facebook facebook-graph-api parse-platform


    【解决方案1】:

    我尝试了一些东西,它奏效了。

    更改了以下行

     new GraphRequest(
            accessToken,"/me?fields=first_name,last_name",null,...
    

     Bundle bundle = new Bundle();
     bundle.putString("fields","first_name,last_name");
     new GraphRequest(
            accessToken,"/me",bundle,
    

    它奏效了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多