File

src/module/auth/strategy/local.strategy.ts

Index

Methods

Constructor

constructor(authService: AuthService)
Parameters :
Name Type Optional
authService AuthService No

Methods

Async validate
validate(username: string, password: string)
Parameters :
Name Type Optional
username string No
password string No
Returns : Promise<any>
import { Strategy } from 'passport-local';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { AuthService } from '../service/auth.service';

@Injectable()
export class LocalStrategy extends PassportStrategy(Strategy) {

	constructor(private readonly authService: AuthService) {

		super({
			usernameField: 'email'
		});

	}

	async validate(username: string, password: string): Promise<any> {
		return await this.authService.authenticate(username, password);
	}

}

result-matching ""

    No results matching ""