Question

My company's recently refreshed our FaceBook application so it uses the Canvas Iframe with the PHP 3.1.1 SDK. Everything works great, except for this one FQL query that keeps sending an error: #102 - "Requires User Session".

What does this even mean? It doesn't happen with all users, and it's not exclusive to any particular browser. There have been other people asking about this, but I can't find any solution that's less than a year old that doesn't shove it off with "just have them log in again".

Here is a copy of the FB Error array and the FB Object (with a few things starred out for privacy)

Array
(
    [error_code] => 102
    [error_msg] => Requires user session
    [request_args] => Array
    (
        [0] => Array
            (
                [key] => method
                [value] => fql.query
            )

        [1] => Array
            (
                [key] => query
                [value] => 
SELECT page_id
FROM page_admin
WHERE uid=me() AND page_id=####
LIMIT 1
            )

        [2] => Array
            (
                [key] => callback
                [value] => 
            )

        [3] => Array
            (
                [key] => api_key
                [value] => ###
            )

        [4] => Array
            (
                [key] => format
                [value] => json-strings
            )

        [5] => Array
            (
                [key] => access_token
                [value] => ###
            )

    )

)
Facebook Object
(
    [appId:protected] => ###
    [apiSecret:protected] => ###
    [user:protected] => 
    [signedRequest:protected] => Array
    (
        [algorithm] => HMAC-SHA256
        [issued_at] => 1315334757
        [page] => Array
            (
                [id] => ###
                [liked] => 
                [admin] => 
            )

        [user] => Array
            (
                [country] => us
                [locale] => en_US
                [age] => Array
                    (
                        [min] => 21
                    )

            )

    )

    [state:protected] => 
    [accessToken:protected] => ###
    [fileUploadSupport:protected] => 
)

It's getting really frustrating to have this error cropping up when our Dev team can't find any official documentation or solution for it.

I did find this post from last year ( Requires user session error while using FQL in facebook ) but the solution it provides is no longer relevant to SDK 3.1.1.

Any help would be appreciated.

Was it helpful?

Solution 3

The issue ended up being this: even though the page admin's were being asked for the appropriate permissions, the page that was displaying to the general public for the app ALSO asked for it. There is a delay between when the admin authorizes the app and when the data from our site actually starts showing up on their facebook page, and the page that displayed whenever Joe Public came across the app would ask them for permissions and error out when they said no.

Modifying the app's public default page fixed the issue.

OTHER TIPS

current php SDK is 3.1.1
https://github.com/facebook/php-sdk/

I'd suggest to update and check if you get the same error message, it might be because of inconsistency with the most current javascript SDK and older php SDK you use.

hope this helps

Please check also if you require manage_pages permission
https://developers.facebook.com/docs/reference/fql/page_admin/

it is required from September 22, 2011 for this type of query

hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top