Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook PHP SDK: Unknown path components

I'm trying to validate Facebook App ID and App Secret. With Graph Explorer, I'm able to use access token in shape of {APP_ID}|{APP_SECRET} to get app details on /v2.5/{APP_ID} endpoint.

It doesn't work with PHP SDK though. The error I'm getting is:

Unknown path components: /{APP_ID}

The code I used is this:

$facebook = new Facebook\Facebook( [
    'app_id' => $app_id,
    'app_secret' => $app_secret,
    'default_graph_version' => '2.5',
] );

$facebook->get( '/' . $app_id, $app_id . '|' . $app_secret );

It does the validation, because with invalid app ID I'm getting:

Error validating application. Cannot get application info due to a system error.

And with invalid secret:

Invalid OAuth access token signature.

How can I get the app details just like in graph explorer? I have no idea what I'm doing wrong, the request seems to be correct. Please help.

like image 664
Robo Robok Avatar asked Apr 28 '26 12:04

Robo Robok


1 Answers

There is a typo in default_graph_version. It needs to be prefixed with v (standing for version), so the correct declaration is:

'default_graph_version' => 'v2.5',
like image 139
Robo Robok Avatar answered May 01 '26 02:05

Robo Robok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!