开发者

What is the correct way to request permissions in a Facebook iFrame application with the JS SDK?

开发者 https://www.devze.com 2023-04-05 16:28 出处:网络
I\'m currently using a method like this: FB.ui({ method: \'oauth\', perms: \"user_photos\" }, post_auth_callback);

I'm currently using a method like this:

FB.ui({ method: 'oauth', perms: "user_photos" }, post_auth_callback);

Has the开发者_如何学Python OAuth 2.0 upgrade changed how permissions should be requested? The current Facebook documentation doesn't show a perms param. It looks like it has been replaced with a scope param. However, in testing, the scope param is ignored and it simply requests standard access.


Try using the FB.login() method and pass the scope parameter as you mentioned. Also, make sure you set the oauth parameter to true in your call to FB.init() so that OAuth 2.0 is enabled.

FB.login(function(response) {
        if(response.authResponse) {
            console.log("photo permissions granted")'
        } else {
            console.log("photo permissions denied")'
        }
    }, {
        scope : 'user_photos,friends_photos'
    });
0

精彩评论

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

关注公众号