Gili
Gili

Reputation: 213

facebook request returns OAuthException: "An active access token must be used to query information about the current user"

I am trying to send a facebook request with the following code:

new Request(
                    session,
                    "/me?fields=birthday",
                    null,
                    HttpMethod.GET,
                    new Request.Callback() {
                        public void onCompleted(Response response) {
                            if(response.getGraphObject() != null)
                            {
                                GraphObject go = response.getGraphObject();
                            }


                        }
                    }
                ).executeAsync(); 

The session I pass is valid and open, and the access token inside it is also valid (I doubled checked with the Access Token Debugger). Also, its permissions include the user_birthday permissions needed for the birthday. However, I still get the OAuthException: {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: An active access token must be used to query information about the current user.}

Did anyone encounter a familiar problem?

Thanks.

Upvotes: 0

Views: 888

Answers (1)

Serhii Nadolynskyi
Serhii Nadolynskyi

Reputation: 5563

Just faced this problem

You can pass fields as bundle as shoved here: https://stackoverflow.com/a/21855119/2010395

        Bundle params = new Bundle();
        params.putString("fields", "birthday");
        new Request(session, "me", params, HttpMethod.GET,
                new Request.Callback() {
                    public void onCompleted(Response response) {
                        if (response.getGraphObject() != null) {
                            GraphObject go = response.getGraphObject();
                        }

                    }
                }).executeAsync();

Upvotes: 0

Related Questions