forked from simov/grant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (28 loc) · 803 Bytes
/
Copy pathapp.js
File metadata and controls
31 lines (28 loc) · 803 Bytes
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
var express = require('express')
var session = require('express-session')
var grant = require('grant-express')
express()
.use(session({secret: 'grant', saveUninitialized: true, resave: true}))
.use(grant({
defaults: {
protocol: 'http',
host: 'localhost:3000'
},
facebook: {
key: '[APP_ID]',
secret: '[APP_SECRET]',
callback: '/facebook_callback'
},
twitter: {
key: '[CONSUMER_KEY]',
secret: '[CONSUMER_SECRET]',
callback: '/twitter_callback'
}
}))
.get('/facebook_callback', (req, res) => {
res.end(JSON.stringify(req.query, null, 2))
})
.get('/twitter_callback', (req, res) => {
res.end(JSON.stringify(req.query, null, 2))
})
.listen(3000, () => console.log(`Express server listening on port ${3000}`))