-
Notifications
You must be signed in to change notification settings - Fork 211
/
Copy pathtwitter.js
executable file
·43 lines (31 loc) · 1.08 KB
/
twitter.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
'use strict';
const Bell = require('..');
const Hapi = require('@hapi/hapi');
const internals = {};
internals.start = async function () {
const server = Hapi.server({ port: 8000 });
await server.register(Bell);
// Make sure to set a "Callback URL" and
// check the "Allow this application to be used to Sign in with Twitter"
// on the "Settings" tab in your Twitter application
server.auth.strategy('twitter', 'bell', {
provider: 'twitter',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '', // Set client id
clientSecret: '' // Set client secret
});
server.route({
method: '*',
path: '/bell/door',
options: {
auth: 'twitter',
handler: function (request, h) {
return '<pre>' + JSON.stringify(request.auth.credentials, null, 4) + '</pre>';
}
}
});
await server.start();
console.log('Server started at:', server.info.uri);
};
internals.start();