forked from hapijs/bell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meetup.js
46 lines (36 loc) · 1.34 KB
/
meetup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
// Load modules
const Hapi = require('hapi');
const Hoek = require('hoek');
const Bell = require('../');
const server = new Hapi.Server();
server.connection({ port: 8000 });
server.register(Bell, (err) => {
Hoek.assert(!err, err);
server.auth.strategy('meetup', 'bell', {
provider: 'meetup',
password: 'cookie_encryption_password_secure',
isSecure: false,
// Firstly give the meetup oauth docs a quick glance --> http://www.meetup.com/meetup_api/auth/#oauth2
// Secondly you'll need to create an OAuth consumer --> https://secure.meetup.com/meetup_api/oauth_consumers/
// Now you can fill in the required fields below and take this example for a test drive
clientId: '',
clientSecret: ''
// Uncomment the below line for more scopes, if not you get the "basic" scope by default
// scope: ['basic', 'ageless', 'group_edit', 'reporting']
});
server.route({
method: '*',
path: '/bell/door',
config: {
auth: 'meetup',
handler: function (request, reply) {
reply('<pre>' + JSON.stringify(request.auth.credentials, null, 4) + '</pre>');
}
}
});
server.start((err) => {
Hoek.assert(!err, err);
console.log('Server started at:', server.info.uri);
});
});