diff options
author | eug-vs <eug-vs@keemail.me> | 2020-07-05 13:13:27 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-07-05 13:27:45 +0300 |
commit | 7b24ceaaece34dfe1057f432d00723e27d8c3ea9 (patch) | |
tree | 5479b74b86fc92bcb5b3a716cbc96a14c58fdaab | |
parent | b25ddb209fa043499a0ead4f2f150507f4580a22 (diff) | |
download | which-api-7b24ceaaece34dfe1057f432d00723e27d8c3ea9.tar.gz |
fix: improve tryAuthenticate to resolve token bug
-rw-r--r-- | hooks/tryAuthenticate.ts | 5 |
1 files changed, 4 insertions, 1 deletions
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<HookContext> => { - return authenticate('jwt')(context).catch(() => context); + if (context.params?.headers?.authorization && context.path !== 'authentication') { + return authenticate('jwt')(context); + } + return context; }; |