How can I set email in onCreateUser function?


#1

Now I working with social login and can’t set email address.

Accounts.onCreateUser(function(options, user) {
user.email = [
    	'test@mail.com'
]; // doesn't work
user.email = 'test@mail.com'; // doesn't work too
return user;
});

After login I get only this when calling Meteor.user() in my console:
{_id: “YH7uRvtboAv2oPWcc”, profile: {…}, username: “test”}


#2
 user.emails = [
      {
            "address" : 'test@mail.com', 
            "verified" : true
      }
];