Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HybridAuth Facebook login error: "Invalid Scopes: offline_access, publish_stream, read_friendlists"

I am using the HybridAuth library with CodeIgniter Bonfire for adding login functionality with Facebook . I added the library and all related required files into Bonfire.

After clicking on the Login with Facebook button, I am redirected to the Facebook authorization page, but Facebook gives this error:

Invalid Scopes: offline_access, publish_stream, read_friendlists. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions..

How can I solve this?

like image 602
Gitesh Purbia Avatar asked May 07 '15 06:05

Gitesh Purbia


3 Answers

To elaborate on @luschn's answer, the permissions which HybridAuth requests from Facebook by default (as of version 2.4.1) are email, user_about_me, user_birthday, user_hometown, user_website, offline_access, read_stream, publish_stream, read_friendlists.

Here's how to remove those depreciated scopes in your HybridAuth config file:

<?php
return
    array(
        'base_url' => 'http://localhost/your/hybridauth/endpoint/index.php',

        'providers' => array (

            'Facebook' => array (
                'enabled' => true,
                'keys'    => array ( 'id' => 'YOUR-APP-ID', 'secret' => 'YOUR-APP-SECRET-TOKEN' ),
                'scope'   => 'email, user_about_me, user_birthday, user_hometown, user_website, read_stream',
                'trustForwarded' => false
            ),
        ),
    );
like image 148
Arman H Avatar answered Sep 27 '22 21:09

Arman H


All those scopes/permissions are deprecated since years - which is exactly what the error message tells you, they just don´t exist. You need to check out the Facebook docs to find out which permissions exactly you need. The API Reference is a good place to find out.

like image 45
andyrandy Avatar answered Sep 27 '22 21:09

andyrandy


current answer of @Arman H would not work, IF YOU DEFINE email in scope you will receive public profile and email adress

<?php
return
    array(
        'base_url' => 'http://localhost/your/hybridauth/endpoint/index.php',
        'providers' => array (
            'Facebook' => array (
                'enabled' => true,
                'keys'    => array ( 'id' => 'YOUR-APP-ID', 'secret' => 'YOUR-APP-SECRET-TOKEN' ),
                'scope'   => 'email',
                'trustForwarded' => false
            ),
        ),
    ); 
like image 35
edgarmtze Avatar answered Sep 27 '22 21:09

edgarmtze