Meteor.loginWithFacebook - how to add email to user profile?

I’ve got a basic OAuth login with Facebook.
My click event for this is fairly simple:{
	'click .account_login_facebook':function(event){
		Meteor.loginWithFacebook({requestPermissions: [ 'email' ]}, function(err){
			if(!err) {


The {requestPermissions: [ 'email' ]} works as expected.
But the Users email is never added to the user.profile, so I don’t have access to it later.

Main Question:
How can I attach the email to the profile?

Extra Question:
I’m also a little bit confused by the Guide on the Meteor.users collection.

When I login with either email or facebook my user object looks very different.
In the guide the user object has many more fields.

After Login with facebook:

Thanks for any kind of help!

For facebook you can access it in on the server in Account.onCreateUser() as such.

   Accounts.onCreateUser(function(options, user) {
      var email =
         //add to the user object, I just add it here as such

         user.emails = [{address: email, verified: true}];
       return user

You can add any field you want in this method. it will trigger whenever an account is created, email, facebook or otherwise, so it might be wise to put a check in there to pull the appropriate email from a specific service.


Uh, thanks, that’s awesome!
Exactly what I needed! :slight_smile: