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.
精彩评论