开发者

What is the proper way to ask for Extended Permissions on Facebook with Javascript?

开发者 https://www.devze.com 2023-04-13 04:14 出处:网络
Should I still be using开发者_开发问答 permissions.request or is there a new way to do this? I\'ve seen conflicting info.

Should I still be using开发者_开发问答 permissions.request or is there a new way to do this? I've seen conflicting info. Thanks!


Well you can use FB.login() with the scope parameter:

 FB.login(function(response) {
   if (response.authResponse) {
     console.log('Welcome!  Fetching your information.... ');
     FB.api('/me', function(response) {
       console.log('Good to see you, ' + response.name + '.');
       FB.logout(function(response) {
         console.log('Logged out.');
       });
     });
   } else {
     console.log('User cancelled login or did not fully authorize.');
   }
 }, {scope: 'email'});

Ironically, Facebook just posted a tutorial related to this yesterday. Also I have written a tutorial about this a while back.

0

精彩评论

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

关注公众号