Meteor\'s accounts-facebook
package was very easy to set up. To input the Facebook app ID and secret token, I loaded my meteor web app in a browser, and clicked on
[NOTE: for Meteor >= 1.2.2]
The official Meteor documentation here explains how to do it.
Add the service-configuration
package (otherwise you can't use ServiceConfiguration
):
$ meteor add service-configuration
Then you can put this in Meteor.startup
:
Meteor.startup(function () {
// Set Facebook app configurations
ServiceConfiguration.configurations.upsert({
service: "facebook"
}, {
$set: {
appId: 'YOUR_APP_ID',
secret: 'YOUR_APP_SECRET'
}
});
return;
});
Externalize Facebook configurations in settings.json
Perhaps the final solution is to put Facebook app's configurations in a setting file
/settings.json
Like this:
{
"facebook" : {
"appId": "APP_ID",
"secret": "APP_SECRET"
}
}
Then you have to start your Meteor application with
$ meteor --settings settings.json
in order to load the settings file.
Finally you can load Facebook configurations inside Meteor.startup
from the settings file:
Meteor.startup(function () {
// Load and set Facebook app configurations
var facebookConfig = Meteor.settings.facebook;
ServiceConfiguration.configurations.upsert({
service: "facebook"
}, {
$set: {
appId: facebookConfig.appId,
secret: facebookConfig.secret
}
});
return;
});