Getting user application data in api v2 graphics using global identifiers

So, version 2 of the Facebook graphical API introduces application-specific identifiers to protect user privacy from spam or something like that. But they said that users who added your application to v1 using a global identifier would still send you their global identifier in v2 to keep your application backward compatible.

This is all fine, but the v2 api also prohibits receiving user data with global identifiers. Calling a graph with global identifiers from within the canvas application gives an exception that says instead of using the application identifier.

I was a little confused. I am trying to get basic information about a random subset of application users in order to display the current user, who is not necessarily a friend. But most of my users have global identifiers stored in my database because they have long joined. It seems that if my application was new, all identifiers stored in my database would be application specific, and so I could get their information. This indicates that this is not the intention of Facebook to prevent me from receiving the data that I want. This is simply not possible for me due to the unsuccessful situation with the old application.

Is there any way to get this data? I know that I can return to v1 schedule, but it will disappear on April 30, 2015. I need only the most basic information, and I only show the names.

I am using version 4 of the PHP SDK. My query looks like this:

(new FacebookRequest(
            self::$session, 'GET', '',
            array('ids' => implode(',', $userIds))
        ))->execute()->getGraphObjectList(GraphUser::className());

My session comes from a call getSessionon FacebookCanvasLoginHelper, as shown in their docs, so I have a new access token and a signed request.

change

So, I cancel my question because I'm stupid. Sahil is right. My problem was that I work in a separate application for testing (not an official test application, but an application that I created a long time ago for testing), so the specified application identifiers did not actually add the application, so I can get their information. Unfortunately. A good reason to upgrade to the official test application.

change again

. Facebook . , , , , . , , :

Facebook\FacebookAuthorizationException: The global ID 693041250 is not allowed.
Please use the application specific ID instead.

dev- :

  • ID- ,, , , .

. . Facebook. , , . - ? Facebook .

+4
1

, -

, v1, , v2, .

: v2 api . canvas , .

, , API v2 ( ).

, SDK, ( SDK), , . Graph API Explorer, (-) /v2/{user-id} v1 , . - .

+1

Source: https://habr.com/ru/post/1546068/


All Articles