forked from hapijs/bell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharcgisonline.js
executable file
·50 lines (36 loc) · 1.24 KB
/
arcgisonline.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
47
48
49
50
'use strict';
// Load modules
const Bell = require('../');
const Hapi = require('hapi');
// Declare internals
const internals = {};
internals.start = async function () {
const server = Hapi.server({ port: 8000 });
await server.register(Bell);
// You'll need to go to https://developers.arcgis.com/en/applications and set up an application to get started
// Once you create your app you will get your ClientID and Client Secret.
// Also be sure to set redirect URL as well at the bottom of the screen in Redirect URIs section.
server.auth.strategy('arcgisonline', 'bell', {
provider: 'arcgisonline',
password: 'cookie_encryption_password_secure',
isSecure: false,
clientId: '',
clientSecret: '',
providerParams: {
redirect_uri: server.info.uri + '/bell/door'
}
});
server.route({
method: '*',
path: '/bell/door',
options: {
auth: 'arcgisonline',
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();