aboutsummaryrefslogtreecommitdiff
path: root/hooks/tryAuthenticate.ts
blob: 71306ba626c72ede59322a0a38afbeb3a948975b (plain)
1
2
3
4
5
6
7
8
9
10
11
import { HookContext } from '@feathersjs/feathers';
import { authenticate } from '@feathersjs/authentication';


export default async (context: HookContext): Promise<HookContext> => {
  if (context.params?.headers?.authorization && context.path !== 'authentication') {
    return authenticate('jwt')(context);
  }
  return context;
};