[Upgrade to 1.2] Accounts.loginWithFacebook is now undefined

After an upgrade to Meteor 1.2 of a year-old project (v1.0.4), the only thing that somehow broke is the integration with accounts-facebook and I cannot use Accounts.loginWithFacebook anymore. The package is installed, and I already tried to remove it and add it again to see if it was a dependency issue.

Here’s my package list for the project.

Any ideas where to look? I’ve been struggling with this for hours.

Thanks!

Try create new appId and appSecret

What happens when you call Meteor.loginWithFacebook() from the console?

To login with Facebook in 1.2, I’ve done this:

On the server:

ServiceConfiguration.configurations.upsert(
    { service: "facebook" },
    {
        $set: {
            appId: Meteor.settings.facebookAppId,
            secret: Meteor.settings.facebookAppSecret
        }
    }
);

Then to login:

Meteor.loginWithFacebook({}, function(err) {
  if (err) { throw new Meteor.Error("Facebook login failed"); }
});

Make sure you’re using the right packages:

service-configuration
accounts-facebook

Rather than Accounts.loginWithFacebook use Meteor.loginWithFacebook()

1 Like

Thank you @floydprice and @sergiotapia. As you mentioned, I was calling Accounts.loginWithFacebook when I should have been using Meteor.loginWithFacebook… thank you so much and sorry for this quite embarrassing mistake.

Have a good day!

1 Like