Jaspermid
Jaspermid

Reputation: 461

Meteor: Facebook username not displaying

I have a Facebook login running within my app and a user page to display the most important user details. When I login using a password then the following code:

user: function(){
    return Meteor.user().username
},

with:

<h1>Welcome {{user}}</h1>

return the username. When i am logged in with Facebook login the username is blank.

How can I access the current users username when logged in through Facebook?

Thanks

Upvotes: 3

Views: 1340

Answers (2)

許宸維
許宸維

Reputation: 11

return Meteor.user().username || Meteor.user().profile.name

It works for me.

Upvotes: 1

Jaspermid
Jaspermid

Reputation: 461

Thanks to the comment by @user3374348 managed to find it

Facebook username is found in profile.name. So

 return Meteor.user().username || Meteor.user().profile.name

returns either the username if available or otherwise the Facebook name.

thanks for the help

Upvotes: 7

Related Questions