aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/oauth.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
commit69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch)
treead199a18ec3c322460d6f9523fc383ee562554e0 /server/middlewares/oauth.ts
parent4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff)
downloadPeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.gz
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.zst
PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.zip
Type functions
Diffstat (limited to 'server/middlewares/oauth.ts')
-rw-r--r--server/middlewares/oauth.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts
index 468e41810..d545b3e58 100644
--- a/server/middlewares/oauth.ts
+++ b/server/middlewares/oauth.ts
@@ -1,3 +1,5 @@
1import 'express-validator'
2import * as express from 'express'
1import * as OAuthServer from 'express-oauth-server' 3import * as OAuthServer from 'express-oauth-server'
2 4
3import { OAUTH_LIFETIME } from '../initializers' 5import { OAUTH_LIFETIME } from '../initializers'
@@ -9,7 +11,7 @@ const oAuthServer = new OAuthServer({
9 model: require('../lib/oauth-model') 11 model: require('../lib/oauth-model')
10}) 12})
11 13
12function authenticate (req, res, next) { 14function authenticate (req: express.Request, res: express.Response, next: express.NextFunction) {
13 oAuthServer.authenticate()(req, res, function (err) { 15 oAuthServer.authenticate()(req, res, function (err) {
14 if (err) { 16 if (err) {
15 logger.error('Cannot authenticate.', { error: err }) 17 logger.error('Cannot authenticate.', { error: err })
@@ -22,7 +24,7 @@ function authenticate (req, res, next) {
22 }) 24 })
23} 25}
24 26
25function token (req, res, next) { 27function token (req: express.Request, res: express.Response, next: express.NextFunction) {
26 return oAuthServer.token()(req, res, next) 28 return oAuthServer.token()(req, res, next)
27} 29}
28 30