0
votes

I am using facebook and meteor accounts-password login to register users. I want to get the name of all the users in the Meteor.users database. Currently I am proceeding like this :

{{#each users}}
    <li>
        <a href = "/chatTime/:{{_id}}">{{username}}</a>
    </li>
{{/each}}

I am able to get username of users logged in through accounts-password and not through facebook. How to proceed?

1

1 Answers

0
votes

You need to use Accounts.onCreateUser() to be able to save anything from facebook or other services. Here is an example with profile picture and email included.

Accounts.onCreateUser(function(options,user){
    if (typeof(user.services.facebook) != "undefined") {
        user.email = user.services.facebook.email;
        user.profilePicture = "http://graph.facebook.com/" + user.services.facebook.id + "/picture/?type=large";
        user.username = user.services.facebook.name;
        user.firstName = user.services.facebook.first_name;
        user.lastName = user.services.facebook.last_name;
    }
    return user;
});