Skip to content

Commit

Permalink
added logger to GoogleSocialAuthenticator
Browse files Browse the repository at this point in the history
  • Loading branch information
mapeveri committed May 3, 2024
1 parent ce980d0 commit 8f4cbe6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { Injectable } from '@nestjs/common';
import { SocialAuthenticator } from '@src/languages/domain/auth/socialAuthenticator';
import { OAuth2Client } from 'google-auth-library';
import { ConfigService } from '@nestjs/config';
import { Inject } from '@src/shared/domain/injector/inject.decorator';
import Logger, { LOGGER } from '@src/shared/domain/logger';

@Injectable()
export default class GoogleSocialAuthenticator implements SocialAuthenticator {
private client: OAuth2Client;
private readonly clientId: string | undefined;

constructor(private configService: ConfigService) {
constructor(readonly configService: ConfigService, @Inject(LOGGER) private readonly logger: Logger) {
this.clientId = this.configService.get<string>('GOOGLE_CLIENT_ID');
this.client = new OAuth2Client(this.clientId);
}
Expand All @@ -23,7 +25,7 @@ export default class GoogleSocialAuthenticator implements SocialAuthenticator {

isValid = true;
} catch (e) {
console.error(e);
this.logger.error(`Error trying to verify token: ${e}`);
isValid = false;
}

Expand Down

0 comments on commit 8f4cbe6

Please sign in to comment.