From 161d1fa05dbd2bcf41fca4a577a2cb97e4a99db8 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Mon, 30 Jan 2023 16:35:05 -0300 Subject: [PATCH] Added some logs --- src/modules/auth/auth.controller.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 30c93ec..e7682ac 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -236,6 +236,7 @@ export class AuthController { @Get('oauth/google') @UseGuards(AuthGuard('google-login')) googleOauth() { + this.logger.info('/oauth/google'); return true; } @@ -244,7 +245,10 @@ export class AuthController { @Redirect() async googleOauthCallback(@Req() req) { const { url, email, token, language = 'pt-br' } = await this.callback(req); - if (url.searchParams.get('error')) return { url: url.href }; + if (url.searchParams.get('error')) { + this.logger.error('/oauth/google - ERROR'); + return { url: url.href }; + } await this.authClient .oauthSignIn({ @@ -252,9 +256,11 @@ export class AuthController { token, }) .then(({ session }) => { + this.logger.info('/oauth/google - SUCESS'); url.searchParams.set('session', session); }) .catch((err) => { + this.logger.error('/oauth/google - ERROR'); let error = OauthErrors.INVALID_CREDENTIALS[language].error; let error_description = OauthErrors.INVALID_CREDENTIALS[language].error_description;