How to use the @feathersjs/authentication-local/lib/.hooks.protect function in @feathersjs/authentication-local

To help you get started, we’ve selected a few @feathersjs/authentication-local examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github autoai-org / AID / components / discovery / src / services / users / users.hooks.ts View on Github external
import * as feathersAuthentication from '@feathersjs/authentication';
// Don't remove this comment. It's needed to format import lines nicely.

const { authenticate } = feathersAuthentication.hooks;

import {hooks} from '@feathersjs/authentication-local/lib/';


export default {
  before: {
    all: [],
    find: [ authenticate('jwt'), hooks.protect("password") ],
    get: [ authenticate('jwt'), hooks.protect("password") ],
    create: [ hooks.hashPassword("password"), hooks.protect("password") ],
    update: [ hooks.hashPassword("password"), authenticate('jwt'), hooks.protect("password") ],
    patch: [  hooks.hashPassword("password"), authenticate('jwt'), hooks.protect("password") ],
    remove: [ authenticate('jwt'), hooks.protect("password") ]
  },

  after: {
    all: [ 
    ],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  error: {