meteor / tutorials

The Meteor tutorials from meteor.com
https://www.meteor.com/tutorials
MIT License
181 stars 103 forks source link

Facebook suggested example requires a tweak to work #22

Open fsodano opened 8 years ago

fsodano commented 8 years ago

In step 9, in the "Automatic accounts UI" section, the guide suggests that you try out Facebook but it doesn't work out of the box, since the example provided uses Meteor.user().username which is not available once logged in with Facebook (instead, you must use Meteor.user().profile.name).

stubailo commented 8 years ago

Ah that's a good point. What is the best solution? Should we document that in the tutorial?

enriquemanuel commented 8 years ago

I would suggest to add it to the tutorial, in the section "Automatic accounts UI" after:

If you are adventurous, you can add the accounts-facebook package to enable Facebook login in your app - the Facebook button will automatically appear in the dropdown.

you can add the code section to do, rename the Task insert.

The only catch here, is that since you are allowing both options to be used, then if an user is logging in, without FB it wont work again.

Since I'm new to Meteor, isn't there a way to check to do one or the other, maybe like:

if (facebook-automatic-login used){
 username: Meteor.user().profile.name
}else{
 username:Meteor.user().username
}

just an idea.