forked from snychka/node-express-oauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.js
46 lines (38 loc) · 969 Bytes
/
client.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
const express = require("express")
const bodyParser = require("body-parser")
const axios = require("axios").default
const { randomString, timeout } = require("./utils")
const config = {
port: 9000,
clientId: "my-client",
clientSecret: "zETqHgl0d7ThysUqPnaFuLOmG1E=",
redirectUri: "http://localhost:9000/callback",
authorizationEndpoint: "http://localhost:9001/authorize",
tokenEndpoint: "http://localhost:9001/token",
userInfoEndpoint: "http://localhost:9002/user-info",
}
let state = ""
const app = express()
app.set("view engine", "ejs")
app.set("views", "assets/client")
app.use(timeout)
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
/*
Your code here
*/
const server = app.listen(config.port, "localhost", function () {
var host = server.address().address
var port = server.address().port
})
// for testing purposes
module.exports = {
app,
server,
getState() {
return state
},
setState(s) {
state = s
},
}