facebookarchive / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
3.17k stars 1.96k forks source link

Unable to get FB Pages with valid access token #1102

Open junaidatique opened 5 years ago

junaidatique commented 5 years ago

I am using graph api v2.12. I am trying to get user pages for my app, when user allow all the permissions. App works fine for the auth part and user do allow all the permissions. The app get valid access token but when I make api call to get the pages I get this unexpected error.

// using facebook php sdk

 $response = $fb->get('/me?fields=accounts', $access_token);

// for my own account I always get status code 500
// response
[httpStatusCode:protected] => 500
            [headers:protected] => Array
                (
                    [Vary] => Accept-Encoding
                    [x-app-usage] => {"call_count":0,"total_cputime":0,"total_time":0}
                    [WWW-Authenticate] => OAuth "Facebook Platform" "unknown_error" "An unexpected error has occurred. Please retry your request later."
                    [Content-Type] => application/json; charset=UTF-8
                    [facebook-api-version] => v2.12
                    [x-fb-rev] => 4699773
                    [Access-Control-Allow-Origin] => *
                    [Cache-Control] => no-store
                    [x-fb-trace-id] => G3l3jRt3Uzo
                    [Expires] => Sat, 01 Jan 2000 00:00:00 GMT
                    [Strict-Transport-Security] => max-age=15552000; preload
                    [Pragma] => no-cache
                    [X-FB-Debug] => V7R8O76AAYhfHXjasdn6k1fDej0iZC6KoQHRV8fhDl5C/KOD/Go/dKluxW8zZ0kf/vdFbeXsPpGgal5aRcszWg==
                    [Date] => Mon, 21 Jan 2019 19:12:41 GMT
                    [Connection] => keep-alive
                    [Content-Length] => 170
                )

            [body:protected] => {"error":{"message":"An unexpected error has occurred. Please retry your request later.","type":"OAuthException","is_transient":true,"code":2,"fbtrace_id":"G3l3jRt3Uzo"}}

I have created a facebook but but they are not helping.

oprisflorentina commented 5 years ago

Happens to me as well, but only the first request returns error. Could you provide a link to the bug you opened on FB please?

junaidatique commented 5 years ago

@oprisflorentina https://developers.facebook.com/support/bugs/1972772503016866/?disable_redirect=0

They have accepted the bug and now it is assigned for fixing.