From 0c8a53f85e4ea93422509d8ad83f56d75c1c4c02 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Mon, 30 Mar 2026 18:12:51 +0300 Subject: [PATCH] Fix Meta OAuth 404 by adding missing @Get decorators and update redirects --- src/auth/auth.controller.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index a8ea652..61624a2 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -18,6 +18,8 @@ export class AuthController { private readonly googleAdsService: GoogleAdsService, ) {} + @Get('meta') + @ApiOperation({ summary: 'Redirect to Meta Login | التوجيه لتسجيل الدخول بميتا' }) async loginToMeta(@Query('userId') userId: string, @Res() res: Response) { const appId = this.configService.get('meta.appId'); const redirectUri = this.configService.get('meta.redirectUri'); @@ -26,6 +28,8 @@ export class AuthController { return res.redirect(url); } + @Get('meta/callback') + @ApiOperation({ summary: 'Meta OAuth Callback | استقبال كود ميتا' }) async metaCallback(@Query('code') code: string, @Query('state') state: string, @Res() res: Response) { if (!code) return res.status(HttpStatus.BAD_REQUEST).json({ message: 'No code provided' }); try { @@ -46,11 +50,11 @@ export class AuthController { } // Redirect back to dashboard with success - const frontendUrl = 'http://localhost:5001'; // Should be dynamic in prod + const frontendUrl = '/frontend'; return res.redirect(`${frontendUrl}?auth=success&platform=meta`); } catch (error) { this.logger.error('Meta Auth failed:', error.message); - return res.redirect('http://localhost:5001?auth=failed'); + return res.redirect('/frontend?auth=failed'); } }