0

I created a facebook app, this app needs to ask for user_friends permission.

But when I give this permission in admin settings section under permission, it doesn't change the permission for my app other then this permission I can set.

Why this specific permission (user_friends) can't be set? Is there anything extra I need to do to set this permission?

4

2 回答 2

4

To ask for additional permission like user_friends you need to add the permission as scope when generating the login URL, instead of adding it under permissions section of the admin settings page of your app.

If you are using PHP for your development, then you be to provide the scope as a parameter to the getLoginUrl ().

$params = array(
                          'scope' => 'read_stream, friends_likes',
                          'redirect_uri' => 'https://www.myapp.com/post_login_page' ); 
$loginUrl = $facebook->getLoginUrl($params);
于 2013-09-09T01:32:18.370 回答
0

I ran into the same problem, but I was using the koala gem for Ruby on Rails.

After trying their OAuth Playground I found out how to make it work in Rails as well, it's as easy as:

oauth     = Koala::Facebook::OAuth.new(app_id, app_secret, callback_url)
oauth_url = oauth.url_for_oauth_code << "&scope=user_friends"

Maybe this might help other Rails/Facebook API beginners.

于 2013-11-02T22:10:24.063 回答