From 7b24ceaaece34dfe1057f432d00723e27d8c3ea9 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 5 Jul 2020 13:13:27 +0300 Subject: fix: improve tryAuthenticate to resolve token bug --- hooks/tryAuthenticate.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'hooks') diff --git a/hooks/tryAuthenticate.ts b/hooks/tryAuthenticate.ts index e179417..71306ba 100644 --- a/hooks/tryAuthenticate.ts +++ b/hooks/tryAuthenticate.ts @@ -3,6 +3,9 @@ import { authenticate } from '@feathersjs/authentication'; export default async (context: HookContext): Promise => { - return authenticate('jwt')(context).catch(() => context); + if (context.params?.headers?.authorization && context.path !== 'authentication') { + return authenticate('jwt')(context); + } + return context; }; -- cgit v1.2.3