Trying to integrate social media login for my system.
For that I have used following method
Meteor.loginWithFacebook({}, function(err,res){
if (err) {
throw new Meteor.Error("Facebook login failed");
}else{
if(res){
console.log("result : " + res);
}
FlowRouter.go('/');
}
});
Above method successfully creating user and there is a successful
entry in users collection too. I want to access that newly created _id.
Is there any callback available . Thanks in advance!
1
votes
1 Answers
0
votes
Once a user has logged in (regardless of the login method), you can use Meteor.userId() to get the id.
So in your case, as soon as the login with facebook is successful, Meteor.userId() will return that new user _id.
In case you want to full user document, you can use Meteor.user() instead.