Reputation: 2288
I am trying to get the user birthday and user location.
Accounts.ui.config({
requestPermissions: {
facebook: ['user_birthday', 'user_location'],}});
When I sign in with facebook, it does ask me for the permissions for these.
var service = _.pairs(user.services)[0];
var serviceName = service[0];
var serviceData = service[1];
All my facebook details are retrieved from serviceData but birthday and location are not there. Can anyone help? Thanks
Upvotes: 1
Views: 210
Reputation: 5057
You might need to fetch those information Facebook graph API.
The Facebook accessToken
will available in users
collections.
you will get it in users collection document as follows-
{
..........
services:
{
facebook:{
accessToken: <actual-fb-acesstoken>
}
.....
}
With this access token you can get whatever information you want from facebook
One such reference is as follows -
https://github.com/ccorcos/meteor-facebook-login/blob/master/server%2Faccounts.coffee#L1
Upvotes: 2