From dc90d2e9b2738edd3c3eaf045b1e13ae218601e0 Mon Sep 17 00:00:00 2001 From: Anders Gustafsson <34234789+anders-photowall@users.noreply.github.com> Date: Mon, 4 Oct 2021 12:49:13 +0200 Subject: [PATCH] 60 verify token is valid (#61) --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e0eff1f..2e7dd91 100644 --- a/src/index.ts +++ b/src/index.ts @@ -58,7 +58,9 @@ const context = async ({ req }) => { if (authHeader.startsWith('Bearer ')) { const token = authHeader.substring(7, authHeader.length); const res = await verifyToken({ token }); - return { auth: res }; + if (res.isValid) { + return { auth: res }; + } } else if ( process.env.NODE_ENV === 'development' && authHeader == 'Basic ZGV2OnB2N1VmYSFiZVAzeGk='