Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Error: Authentication strategies must have a name

Segui os passos da documentação para criar uma rota de autenticação, porém, au executar o npm run start:dev esse erro é retornado:

[Nest] 1043724  - 18/08/2021 19:57:30   ERROR [ExceptionHandler] Authentication strategies must have a name
Error: Authentication strategies must have a name
    at Authenticator.use (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/passport/lib/authenticator.js:56:22)
    at new MixinStrategy (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/passport/dist/passport/passport.strategy.js:38:34)
    at new LocalStrategy (/home/bussola/Workspace/TesteTrade/api-trade/src/auth/shared/local.strategy.ts:9:5)
    at Injector.instantiateClass (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/injector.js:291:19)
    at callback (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/injector.js:43:41)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Injector.resolveConstructorParams (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/injector.js:119:24)
    at Injector.loadInstance (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/injector.js:47:9)
    at Injector.loadProvider (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/injector.js:69:9)
    at async Promise.all (index 4)
    at InstanceLoader.createInstancesOfProviders (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/instance-loader.js:44:9)
    at /home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/instance-loader.js:29:13
    at async Promise.all (index 10)
    at InstanceLoader.createInstances (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/instance-loader.js:28:9)
    at InstanceLoader.createInstancesOfDependencies (/home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/injector/instance-loader.js:18:9)
    at /home/bussola/Workspace/TesteTrade/api-trade/node_modules/@nestjs/core/nest-factory.js:93:17
1 resposta
solução!

Achei a resposta, eu estava impotando algumas coisas erradas:

Com erro:

import { Strategy } from 'passport-strategy';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { AuthService } from './auth.service';

Correção:

import { Strategy } from 'passport-local';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { AuthService } from './auth.service';