[Solved] Meteor + facebook login (loginWithFacebook) issue. client_id is always undefined in login popup's URL

Issue

When I click facebook login button, it opens the login popup, but
the URL in the popup always shows that client_id=undefined, and gives “Sorry, something went wrong”.

I installed service-configuration and accounts-facebook meteor packages and configured as below. Also, cretead the app & added Facebook Login product in https://developers.facebook.com

Am I missing something? Thank you for your help.

Github Repo https://github.com/yhagio/meteor-tatter

Also added this issue to StackOverflow:

Screenshot:

https://drive.google.com/file/d/0B7APJiFp_MS4N2Vuejd3MkZDVGc/view?usp=sharing

The URL is like this:
https://www.facebook.com/v2.2/dialog/oauth?client_id=undefined&redirect_uri=http://localhost:3000/_oauth/facebook&display=popup&scope=public_profile&state=eyJsb2dpblN0eW...

In server /imports/startup/server/index.js

import { Meteor } from 'meteor/meteor';
import { clientId, secret } from './secret.js';

Meteor.startup(() => {
  ServiceConfiguration.configurations.upsert(
    { service: "facebook" },
    {
      $set: {
        clientId: clientId,
        loginStyle: "popup",
        secret: secret
      }
    }
  );
});

In client /imports/ui/helpers/auth.js

import { Meteor } from 'meteor/meteor';

export default function auth() {

  return new Promise((resolve, reject) => {
    Meteor.loginWithFacebook({
      requestPermissions: ['public_profile']
    }, (err, user) => {
      if (err !== null) return reject(err);
      resolve(user);
    });
  });
}
1 Like

Try it with appId instead of clientId.

4 Likes

Ah! it worked! Thank you very much!

1 Like

Confirming… years later…