Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
};

```
Expand Down
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down