diff --git a/README.md b/README.md index 690ea91..7b9e07e 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ Most of these steps are described in more detail in the [tutorial][], ```js module.exports = { appId: '27ed9330-6710-4983-9380-9f0748ca6b41', - appSecret: '0ef85922-849a-4397-9564-94247f95dd7c' + appSecret: '0ef85922-849a-4397-9564-94247f95dd7c', + baseUrl: 'https://x-x-x-x.ngrok.io' }; ``` diff --git a/index.js b/index.js index 43e2b0b..e74b5ac 100644 --- a/index.js +++ b/index.js @@ -3,9 +3,11 @@ var config = require('./config.js'); var express = require('express'); var fs = require('fs'); -flock.setAppId(config.appId); -flock.setAppSecret(config.appSecret); +// Prefill all the configurations in the flock node_module index.js +flock.appId = config.appId; +flock.appSecret = config.appSecret; +flock.baseUrl = config.baseUrl; var app = express(); // Listen for events on /events, and verify event tokens using the token verifier. @@ -21,13 +23,15 @@ try { } // save tokens on app.install -flock.events.on('app.install', function (event) { +flock.events.on('app.install', function (event, callback) { tokens[event.userId] = event.token; + callback(null, {}); }); // delete tokens on app.uninstall -flock.events.on('app.uninstall', function (event) { +flock.events.on('app.uninstall', function (event, callback) { delete tokens[event.userId]; + callback(null, {}); }); // Start the listener after reading the port from config