开发者

Facebook, extending permissions

开发者 https://www.devze.com 2023-02-13 19:25 出处:网络
Is it possible to extend the original permissions given by the user? So, once he clicked the login button, granted the permissions for the application, but for a specific part of the application I ne

Is it possible to extend the original permissions given by the user?

So, once he clicked the login button, granted the permissions for the application, but for a specific part of the application I need for example the create_events permission but I don't want it from everyone, just from those who 开发者_C百科want to use that party of my application.

Thanks, John


It took me a while to figure this one out. What you have to do is prompt to "login" again. If the user is already logged in, Facebook checks what permissions you are asking for in the "login" function against what is already granted. If some permissions are not yet granted, Facebook prompts the user for those extra permissions, NOT to re-login. That you use the login function to prompt for additional permission I think is counter intuitive. But this is how you would prompt for different permissions only when needed, which is what Facebook recommends.

FB.login(function(response) {
...
}, {'perms':'read_stream,publish_stream,offline_access'});

http://developers.facebook.com/docs/reference/javascript/fb.login/


Here is the PHP implementation:

$loginUrl = $facebook->getLoginUrl(array( "scope" => "read_stream,publish_stream" ));

0

精彩评论

暂无评论...
验证码 换一张
取 消