[Android]Getting error when accessing FACEBOOK user info

Hi all,

I am using facbook SDKBOX, login functionality is working fine when i use
sdkbox::FBAPIParam params;
sdkbox::PluginFacebook::api("/me?fields=gender", “GET”, params, “/me?fields=gender”);
getting errors that AccessTocken removed.

Error log:

12-18 18:40:47.045: D/com.facebook.GraphRequestAsyncTask(3819): execute async task: {RequestAsyncTask: connection: null, requests: [{Request: accessToken: null, graphPath: me, graphObject: null, httpMethod: GET, parameters: Bundle[{access_token=CAAV4mVMX5hYBAC5nRSZCrm5lOzYHHlTZAc5Abw4r5MhZAVvQqO326oNlw3caSls8rH3jNBm0ZB5Oqf60zh2R1HZAyFPxZBIIU7McjPKgSPeSNZBZCVnwlfRFs3fFREpUOdKxz9ytXErbibQkfugL8BFbnUcNiDZAjTZABZCq2Gu76G8cD6pGILeg6fbT950KZAjD4zpQVAODqJGFCVh7n7cb440FpKbEK6E8g34ZD, fields=id,name,first_name,middle_name,last_name,link}]}]}
12-18 18:40:47.055: D/Cocos2dxActivity(3819): onResume()
12-18 18:40:47.057: D/AppTracker(3819): App Event: start
12-18 18:40:47.057: D/cocos2d-x debug info(3819): ##FB onPermission: 1, error: success
12-18 18:40:47.057: D/cocos2d-x debug info(3819): Access Tocken CAAV4mVMX5hYBAC5nRSZCrm5lOzYHHlTZAc5Abw4r5MhZAVvQqO326oNlw3caSls8rH3jNBm0ZB5Oqf60zh2R1HZAyFPxZBIIU7McjPKgSPeSNZBZCVnwlfRFs3fFREpUOdKxz9ytXErbibQkfugL8BFbnUcNiDZAjTZABZCq2Gu76G8cD6pGILeg6fbT950KZAjD4zpQVAODqJGFCVh7n7cb440FpKbEK6E8g34ZD
12-18 18:40:47.062: D/com.facebook.GraphRequestAsyncTask(3819): execute async task: {RequestAsyncTask: connection: null, requests: [{Request: accessToken: {AccessToken token:ACCESS_TOKEN_REMOVED permissions:[public_profile, user_friends]}, graphPath: /me?fields=gender, graphObject: null, httpMethod: GET, parameters: Bundle[{}]}]}

12-18 18:40:47.095: D/AbstractTracker(3819): Event success
12-18 18:40:47.641: D/cocos2d-x debug info(3819): ##FB onAPI: tag -> /me?fields=gender, json -> {“error”:“An active access token must be used to query information about the current user.”,“code”:“2500”}
12-18 18:40:47.641: D/cocos2d-x debug info(3819): Json entered!!!
12-18 18:40:47.641: A/libc(3819): /Volumes/SrinivasBy/Srinivas/Projects/CardGame/CardGameGit/CardGame/proj.android/…/cocos2d/external/flatbuffers/…/json/document.h:839: rapidjson::GenericValue<Encoding, Allocator>& rapidjson::GenericValue<Encoding, Allocator>::operator[](const rapidjson::GenericValue<Encoding, SourceAllocator>&) [with SourceAllocator = rapidjson::MemoryPoolAllocator<>; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>]: assertion “false” failed
12-18 18:40:47.641: A/libc(3819): Fatal signal 6 (SIGABRT), code -6 in tid 3849 (GLThread 7054)

Please help.

Let us ask @Ibon to look into that.

Ibon I have looked into the code and this issue exists and the app crashes in Android.

Information on the current user must always be ok.
This must clearly be a bug.
Checking into this asap.

Checked into this issue, and the only way I can make it to crash is
if i am not previously logged-in.

BTW, the crash happens in FB’s internals, not on sdkbox’s side.

In both, iOS and Android, the app crashes if i request the user’s info w/o login first.
Why you may have lost your access token after login:

  • you have not authorized the user for the application. Check you FB dashboard and see wether you granted access.
  • you are using a FacebookAppID which is in development mode, and your user has no access to it.

Are you using sdkbox’s FB sample ? your own app ?

Thanks.

Thanks for the info.

I will do a quick check on the developer/tester profile to check.

Hi
I am getting a similar error on Android on iOS same is working fine but in Android when I call

sdkbox::FBAPIParam params;
sdkbox::PluginFacebook::api("me?fields=picture.width(125).height(125)", "GET", params, "me");

I get error in response as follows tag -> me, json -> {"error":"An active access token must be used to query information about the current user.","code":"2500"}

I have checked the access token as after login I am sending that to server and the token is fine it allows to call with Graph API tester also.
And this never gets called before Login this only gets called after login is successful and on completion of sending a token to server.
on my Phone i Have an Facebook app installed so it doesn’t ask my anything and just get’s logged in. i tried on different phone without Fb native app and same thing happened no change.
i have latest SDKbox with Facebook installed just few days back. I had issue installing while it was unable to Patch AppDelegate.cpp so I did that manually if still I am missing something do suggest me.

The related log I am getting is Facebook: Facebook don't support 'setAppURLSchemeSuffix' on android: com.example.game

@nite Can you suggest anything by looking into this…??
or tag someone who works on this…??

You want to get user photo that’s 125x125 in size? You can use getPictureURL and scale it to 125x125

How can i use getPictureURL without using APi call ?
As i don’t know hat triggers the call to FBListener::onGetUserInfo after login() it doesn’t trigger so anything else need to be added

The plugin should automatically get current user info after the login, if it didn’t, it probably means there is something wrong with the setup or configuration

If you switch sample’s facebook ID to yours did it work?

I am also having same issue on Android :- An active access token must be used to query information about the current user,
I called below method after login:-

sdkbox::FBAPIParam params;
PluginFacebook::api("me", "GET", params, "me");

and got following error in OnAPI() mehod.

Also FBListener::onGetUserInfo() is not automatically called after login(). what should I do?

Yes this is the issue I am not sure why but happens
You need to use this approach

after login call this

                    std::string urlImg =  "me";
                    sdkbox::FBAPIParam params;
                    params["redirect"] = "false";
                    params["fields"] = "name,etc...";//all custom items
                    sdkbox::PluginFacebook::api(urlImg, "GET", params, "me");

This worked for me after login complete.

We fixed this issue will release the update on 10/26