aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-07-05 13:13:27 +0300
committereug-vs <eug-vs@keemail.me>2020-07-05 13:27:45 +0300
commit7b24ceaaece34dfe1057f432d00723e27d8c3ea9 (patch)
tree5479b74b86fc92bcb5b3a716cbc96a14c58fdaab
parentb25ddb209fa043499a0ead4f2f150507f4580a22 (diff)
downloadwhich-api-7b24ceaaece34dfe1057f432d00723e27d8c3ea9.tar.gz
fix: improve tryAuthenticate to resolve token bug
-rw-r--r--hooks/tryAuthenticate.ts5
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;
};