From f9969b8cd11046c54a3891d085c4fc4c1055a0ad Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Thu, 2 Jun 2022 15:06:37 +0300 Subject: [PATCH] logs: add logs to graphql extract cookie --- functions/graphql/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/graphql/index.js b/functions/graphql/index.js index f217fa2..d9cacbb 100644 --- a/functions/graphql/index.js +++ b/functions/graphql/index.js @@ -5,6 +5,10 @@ const jose = require('jose'); const { CONSTS } = require('../utils'); const extractKey = async (cookieHeader) => { + + console.log('START'); + + console.log('cookieHeader'); const cookies = cookie.parse(cookieHeader ?? ''); const authToken = cookies.Authorization; if (authToken) { @@ -12,6 +16,8 @@ const extractKey = async (cookieHeader) => { const { payload } = await jose.jwtVerify(token, Buffer.from(CONSTS.JWT_SECRET), { algorithms: ['HS256'], }) + + console.log(payload); return payload.pubKey } return null; @@ -22,7 +28,7 @@ const server = new ApolloServer({ schema, context: async ({ event }) => { const userPubKey = await extractKey(event.headers.Cookie) - return { userPubKey, } + return { userPubKey } }, });