Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 135 additions & 1 deletion backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
"@stellar/stellar-sdk": "^14.4.3",
"@types/fluent-ffmpeg": "^2.1.28",
"@types/multer": "^2.0.0",
"@types/passport-google-oauth20": "^2.0.17",
"apple-signin-auth": "^2.0.0",
"bcrypt": "^6.0.0",
"bullmq": "^5.66.6",
"cache-manager": "^7.2.8",
Expand All @@ -65,6 +67,8 @@
"kubo-rpc-client": "^6.1.0",
"multer": "^2.0.2",
"passport": "^0.7.0",
"passport-apple": "^2.0.2",
"passport-google-oauth20": "^2.0.0",
"passport-jwt": "^4.0.1",
"pg": "^8.17.1",
"qrcode": "^1.5.3",
Expand Down
42 changes: 42 additions & 0 deletions backend/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import {
HttpStatus,
UseGuards,
Req,
Get,
} from '@nestjs/common';
import type { Request } from 'express';
import { Throttle } from '@nestjs/throttler';
import { AuthGuard } from '@nestjs/passport';
import { AuthService } from './auth.service';
import {
RegisterDto,
Expand Down Expand Up @@ -104,4 +106,44 @@ export class AuthController {
await this.authService.resetPassword(resetPasswordDto);
return { message: 'Password reset successfully' };
}

// --- Google OAuth2 ---

@Get('google')
@UseGuards(AuthGuard('google'))
async googleAuth() {
// Initiates Google OAuth2 flow — handled by Passport
}

@Get('google/callback')
@UseGuards(AuthGuard('google'))
@HttpCode(HttpStatus.OK)
async googleAuthCallback(@Req() req: Request) {
const user = req.user as any;
return {
accessToken: user.accessToken,
refreshToken: user.refreshToken,
user: user.user,
};
}

// --- Apple Sign In ---

@Get('apple')
@UseGuards(AuthGuard('apple'))
async appleAuth() {
// Initiates Apple Sign In flow — handled by Passport
}

@Post('apple/callback')
@UseGuards(AuthGuard('apple'))
@HttpCode(HttpStatus.OK)
async appleAuthCallback(@Req() req: Request) {
const user = req.user as any;
return {
accessToken: user.accessToken,
refreshToken: user.refreshToken,
user: user.user,
};
}
}
Loading
Loading