From b6162d7bb04884081943c98928bdf66418240c23 Mon Sep 17 00:00:00 2001 From: mradigen <55953083+mradigen@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:40:37 +0530 Subject: [PATCH] fix(github_auth): fix GithubStrategy not searching for user using username --- apps/server/src/auth/strategy/github.strategy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/server/src/auth/strategy/github.strategy.ts b/apps/server/src/auth/strategy/github.strategy.ts index 0f475f45..d6f6398e 100644 --- a/apps/server/src/auth/strategy/github.strategy.ts +++ b/apps/server/src/auth/strategy/github.strategy.ts @@ -34,7 +34,9 @@ export class GitHubStrategy extends PassportStrategy(Strategy, "github") { if (!email) throw new BadRequestException(); try { - const user = await this.userService.findOneByIdentifier(email); + const user = + (await this.userService.findOneByIdentifier(email)) || + (await this.userService.findOneByIdentifier(username)); if (!user) throw new UnauthorizedException();