@@ -21,6 +21,7 @@ export class OAuthController {
2121 @ApiOperation ( { summary : 'Google login' } )
2222 @Get ( 'google/login' )
2323 async handleLogin ( @Res ( ) res : FastifyReply ) {
24+ console . log ( 'Google login route hit' )
2425 const baseUrl = 'https://accounts.google.com/o/oauth2/v2/auth'
2526 const params = new URLSearchParams ( {
2627 client_id : process . env . GOOGLE_CLIENT_ID ,
@@ -30,7 +31,8 @@ export class OAuthController {
3031 } )
3132
3233 const googleLoginUrl = `${ baseUrl } ?${ params . toString ( ) } `
33- return res . redirect ( googleLoginUrl )
34+ console . log ( 'Redirecting to:' , googleLoginUrl )
35+ return res . redirect ( googleLoginUrl , 302 )
3436 }
3537
3638 @ApiTags ( 'OAuth2-google' )
@@ -41,10 +43,15 @@ export class OAuthController {
4143 @Res ( ) res : FastifyReply ,
4244 @Req ( ) req : FastifyRequest ,
4345 ) {
46+ console . log ( 'Session before authentication:' , req . session )
47+
4448 try {
4549 await this . googleService . authenticate ( code , req )
46- return res . redirect ( '/auth/status' )
50+ console . log ( 'Session after authentication:' , req . session )
51+ return res . redirect ( '/auth/status' , 302 )
4752 } catch ( error ) {
53+ console . error ( 'Authentication error:' , error )
54+
4855 throw new HttpException (
4956 error . response ?. data ?. message || error . message ,
5057 error . status || HttpStatus . INTERNAL_SERVER_ERROR ,
0 commit comments