Adding Facebook authentication in angular2-meteor


#1

I finished the Socially tutorial and I am trying to extend it further. One primary thing I’m trying to do is add Facebook authentication as an option for logging in.

An inquiry on gitter got me part way. I’ve installed the services-configuration package, and created a service.ts file in server that contains this (replacing appId and secret, of course):

ServiceConfiguration.configurations.upsert({
    "service": "facebook" 
}, {
    $set: {
        "settings": {
            "appId": “appid”,
            “secret": "secret",
            "loginStyle": "popup"
        }
    }
});

But on compile, I get an error saying "cannot find name ‘ServiceConfiguration’ ".

Client side, I’m calling this on a button in a class that has imported Meteor

facebook() {
    Meteor.loginWithFacebook((err) => {
      if (err) {
        //Handle error
      } else {
        //Handle sign in (I reroute)
        this.router.navigate(['/home']);
      }
    })

But when it is clicked I get the error “meteor_1.Meteor.loginWithFacebook is not a function”, presumably linked to the fact that my server side code isn’t working.

It seems like this should be pretty straight forward, but I’ll admit I’m at something of a loss. Any pointers?


#2

Have you done meteor add service-configuration?


#3

Yup, in fact my first thought was the install somehow failed so I’ve reinstalled and uninstalled/installed again. Still same issue.