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.95k forks source link

$fb->get("/me") returns empty array #1187

Open Babwenbiber opened 4 years ago

Babwenbiber commented 4 years ago

I somehow can't get a decent return value from $fb->get("/me"). It always returns an empty array. Same thing for $fb->get("/{$id}"). Here is my code:

$fb = new FB(
                ["app_id" => env("FB_APP_ID"),
                'app_secret' => env("FB_SECRET"),
                'default_graph_version' => 'v2.10',
            ]);
$tok = $request->token;
$fb->setDefaultAccessToken($tok);
$response = $fb->get("{$request->id}");
//$response = $fb->get("/me");
return response()->json($response);

Modifying the user_id or token gives me an error. So it indeed it does a fb API request.

Thanks in advice