From 96cca96bff2f4c52ebfaf6e0c048f536b2037cca Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Sun, 6 Mar 2022 01:09:00 +0300 Subject: [PATCH] fix: Allow external errors for graphql shield --- .../backend/src/helpers/authentication.ts | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/helpers/authentication.ts b/packages/backend/src/helpers/authentication.ts index d058b379..3f5b9da0 100644 --- a/packages/backend/src/helpers/authentication.ts +++ b/packages/backend/src/helpers/authentication.ts @@ -20,14 +20,19 @@ const isAuthenticated = rule()(async (_parent, _args, req) => { } }); -const authentication = shield({ - Query: { - '*': isAuthenticated, +const authentication = shield( + { + Query: { + '*': isAuthenticated, + }, + Mutation: { + '*': isAuthenticated, + login: allow, + }, }, - Mutation: { - '*': isAuthenticated, - login: allow, - }, -}); + { + allowExternalErrors: true, + } +); export default authentication;