Reputation: 402
I can get normal fields such as _id
and username
using:
users: function () {
return Meteor.users.find({}, {fields:{_id:1,username:1}});
}
But how do I get the profile.name
that is from Facebook/Google/Twitter?
Upvotes: 0
Views: 385
Reputation: 386
Use http://docs.meteor.com/#/full/accounts_oncreateuser hook to write profile.name
.
Accounts.onCreateUser(function(options, user) {
// We still want the default hook's 'profile' behavior.
if (options.profile) {
user.profile = options.profile;
user.profile.memberSince = new Date();
// Copy data from Facebook to user object
user.profile.facebookId = user.services.facebook.id;
user.profile.firstName = user.services.facebook.first_name;
user.profile.email = user.services.facebook.email;
user.profile.link = user.services.facebook.link;
}
return user;
});
Getting Facebook Avatar in Meteor when Autopublish is removed
Upvotes: 2