How to set facebook permissions

Each permission has its own set of requirements and suggested use cases. All these permissions, except the default, public_profile, require that you have Client OAuth Login enabled for your app on the Facebook Login tab of your app dashboard.

Basic permissions, (public_profile, user_friends, and email) do not require Review, but all other permissions do.

$fb = new Facebook\Facebook([
            'app_id' => $appId, 
            'app_secret' => $appSecret,
            'default_graph_version' => 'v2.6',
            'default_access_token' => $appId."|".$appSecret
        ]);
        $helper = $fb->getRedirectLoginHelper();

Here is example of how to set permissions in facebook app

$permissions = ['public_profile', 'manage_pages', 'publish_pages'];

you can find more permissions variables form here

$loginUrl = $helper->getLoginUrl('http://yourdomain.com/login.php', $permissions);
echo '<a href="' . htmlspecialchars($loginUrl) . '">Log in with Facebook!</a>';

 

Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Yes0
No0
Harinder Singh

Harinder Singh

My name is Harinder Singh and I specialize in Software industry. I consider myself as a life learner. I love learning new concepts, embracing new ideas and reading and searching for innovation.