Skip to content

Commit 7b24cea

Browse files
committed
fix: improve tryAuthenticate to resolve token bug
1 parent b25ddb2 commit 7b24cea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hooks/tryAuthenticate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { authenticate } from '@feathersjs/authentication';
33

44

55
export default async (context: HookContext): Promise<HookContext> => {
6-
return authenticate('jwt')(context).catch(() => context);
6+
if (context.params?.headers?.authorization && context.path !== 'authentication') {
7+
return authenticate('jwt')(context);
8+
}
9+
return context;
710
};
811

0 commit comments

Comments
 (0)