aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-20 16:23:58 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-20 16:23:58 +0200
commit2f372a865487427ff97ad17edd0e6adfbb478c80 (patch)
tree84e8b2ba2240e83dcdeeb057579327b0a663974b /server/initializers
parent66698b833f77806045b36fdeba612acda43dd7f7 (diff)
downloadPeerTube-2f372a865487427ff97ad17edd0e6adfbb478c80.tar.gz
PeerTube-2f372a865487427ff97ad17edd0e6adfbb478c80.tar.zst
PeerTube-2f372a865487427ff97ad17edd0e6adfbb478c80.zip
Server: implement refresh token
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.js6
-rw-r--r--server/initializers/installer.js2
2 files changed, 7 insertions, 1 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 32fe1645f..7fcf5b01b 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -12,6 +12,11 @@ const FRIEND_SCORE = {
12// Time to wait between requests to the friends (10 min) 12// Time to wait between requests to the friends (10 min)
13let INTERVAL = 600000 13let INTERVAL = 600000
14 14
15const OAUTH_LIFETIME = {
16 ACCESS_TOKEN: 3600 * 4, // 4 hours
17 REFRESH_TOKEN: 1209600 // 2 weeks
18}
19
15// Number of results by default for the pagination 20// Number of results by default for the pagination
16const PAGINATION_COUNT_DEFAULT = 15 21const PAGINATION_COUNT_DEFAULT = 15
17 22
@@ -71,6 +76,7 @@ module.exports = {
71 API_VERSION: API_VERSION, 76 API_VERSION: API_VERSION,
72 FRIEND_SCORE: FRIEND_SCORE, 77 FRIEND_SCORE: FRIEND_SCORE,
73 INTERVAL: INTERVAL, 78 INTERVAL: INTERVAL,
79 OAUTH_LIFETIME: OAUTH_LIFETIME,
74 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT, 80 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
75 PODS_SCORE: PODS_SCORE, 81 PODS_SCORE: PODS_SCORE,
76 REQUESTS_IN_PARALLEL: REQUESTS_IN_PARALLEL, 82 REQUESTS_IN_PARALLEL: REQUESTS_IN_PARALLEL,
diff --git a/server/initializers/installer.js b/server/initializers/installer.js
index 490084104..32830d4da 100644
--- a/server/initializers/installer.js
+++ b/server/initializers/installer.js
@@ -66,7 +66,7 @@ function createOAuthClientIfNotExist (callback) {
66 const secret = passwordGenerator(32, false) 66 const secret = passwordGenerator(32, false)
67 const client = new Client({ 67 const client = new Client({
68 clientSecret: secret, 68 clientSecret: secret,
69 grants: [ 'password' ] 69 grants: [ 'password', 'refresh_token' ]
70 }) 70 })
71 71
72 client.save(function (err, createdClient) { 72 client.save(function (err, createdClient) {