diff --git a/api/src/app.ts b/api/src/app.ts index 27a36f2ed2..166ff48951 100644 --- a/api/src/app.ts +++ b/api/src/app.ts @@ -1,4 +1,5 @@ import expressLogger from 'express-pino-logger'; +import cookieParser from 'cookie-parser'; import bodyParser from 'body-parser'; import express from 'express'; import logger from './logger'; @@ -89,6 +90,8 @@ export default async function createApp() { return next(); }); }); + + app.use(cookieParser()) app.use(extractToken); diff --git a/api/src/controllers/auth.ts b/api/src/controllers/auth.ts index e77befaa24..1fd065f3fe 100644 --- a/api/src/controllers/auth.ts +++ b/api/src/controllers/auth.ts @@ -6,7 +6,6 @@ import grant from 'grant'; import getEmailFromProfile from '../utils/get-email-from-profile'; import { InvalidPayloadException } from '../exceptions/invalid-payload'; import ms from 'ms'; -import cookieParser from 'cookie-parser'; import env from '../env'; import { UsersService, AuthenticationService } from '../services'; import grantConfig from '../grant'; @@ -77,7 +76,6 @@ router.post( router.post( '/refresh', - cookieParser(), asyncHandler(async (req, res, next) => { const accountability = { ip: req.ip, @@ -126,7 +124,6 @@ router.post( router.post( '/logout', - cookieParser(), asyncHandler(async (req, res, next) => { const accountability = { ip: req.ip, diff --git a/api/src/controllers/graphql.ts b/api/src/controllers/graphql.ts index cfa3d5ea9b..5fe09e031c 100644 --- a/api/src/controllers/graphql.ts +++ b/api/src/controllers/graphql.ts @@ -3,14 +3,12 @@ import { GraphQLService } from '../services'; import { respond } from '../middleware/respond'; import asyncHandler from '../utils/async-handler'; import { parseGraphQL } from '../middleware/graphql'; -import cookieParser from 'cookie-parser'; const router = Router(); router.use( '/system', parseGraphQL, - cookieParser(), asyncHandler(async (req, res, next) => { const service = new GraphQLService({ accountability: req.accountability, @@ -28,7 +26,6 @@ router.use( router.use( '/', parseGraphQL, - cookieParser(), asyncHandler(async (req, res, next) => { const service = new GraphQLService({ accountability: req.accountability,