I am trying to use Facebooks PHP SDK to login to my page. However, Facebook ignores the permissions given as an array in getLoginUrl()
$loginUrl = $helper->getLoginUrl(
['publish_actions']
);
The login url looks like:
https://www.facebook.com/v2.3/dialog/oauth?client_id=206265226055767&redirect_uri=http://host.tld/remote/gateway.php&state=67096befe627aa603cb086da681626c1&sdk=php-sdk-4.0.23&scope=publish_actions
However, Facebook still ask for my public_profile and my email
My Question is why Facebook ignores the scope parameter on the oauth login dialog.
Try with this code:
$params = array(
'scope' => 'publish_actions',
'redirect_uri' => 'https://www.myapp.com/post_login_page'
);
$loginUrl = $facebook->getLoginUrl($params);
Not sure if it works the same way with the PHP SDK 4.x though, but you can try this:
$scope = array('publish_actions');
$loginUrl = $helper->getLoginUrl($scope);
...from the well upvoted answer in this thread: Specify app scopes in php facebook sdk 4.0.0 or greater
Of course you can also write it like this:
$loginUrl = $helper->getLoginUrl(array('publish_actions'));
Not sure if it helps in your case, the literal array definition should definitely work in PHP...but you never know ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With