From 7a87d7c39cccb18ff711a9c9a430594cba128ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=A4=80=EC=88=98?= <99115509+hoheesu@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:15:22 +0900 Subject: [PATCH] =?UTF-8?q?Docs:=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20authoriza?= =?UTF-8?q?tion=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/auth.controller.ts | 2 +- src/gameRoom/gameRoom.controller.ts | 5 +++++ src/main.ts | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 2cfe882..41c0c51 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -104,7 +104,7 @@ export class AuthController { summary: '프로필 조회(Protected)', description: '로그인이 필요한 프로필 조회 API', }) - @ApiBearerAuth() // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시 + @ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시 @ApiResponse({ status: 200, description: '정상적으로 접근한 경우', diff --git a/src/gameRoom/gameRoom.controller.ts b/src/gameRoom/gameRoom.controller.ts index d815e29..e258297 100644 --- a/src/gameRoom/gameRoom.controller.ts +++ b/src/gameRoom/gameRoom.controller.ts @@ -20,6 +20,7 @@ import { ApiResponse, ApiBody, ApiParam, + ApiBearerAuth, } from '@nestjs/swagger'; // DTO import @@ -63,6 +64,7 @@ export class GameRoomController { @UseGuards(RedisAuthGuard) // 컨트롤러 전체에 Guard 적용 @Post('create') @ApiOperation({ summary: '방 생성과 동시에 참가' }) + @ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시 @ApiBody({ type: CreateGameRoomDto }) @ApiResponse({ status: 201, @@ -92,6 +94,7 @@ export class GameRoomController { @UseGuards(RedisAuthGuard) // 컨트롤러 전체에 Guard 적용 @Post('join/:roomId') @ApiOperation({ summary: '방 참가' }) + @ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시 @ApiParam({ name: 'roomId', type: Number, description: '참가할 게임 방 ID' }) @ApiResponse({ status: 201, @@ -135,6 +138,7 @@ export class GameRoomController { @UseGuards(RedisAuthGuard) // 컨트롤러 전체에 Guard 적용 @Delete('leave/:roomId') @ApiOperation({ summary: '방 나가기' }) + @ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시 @ApiParam({ name: 'roomId', type: Number, description: '나갈 게임 방 ID' }) @ApiResponse({ status: 200, @@ -179,6 +183,7 @@ export class GameRoomController { @Get(':roomId') @ApiOperation({ summary: '방 상태 조회' }) + @ApiBearerAuth('access-token') // Swagger에서 Bearer Token 헤더를 입력할 수 있도록 표시 @ApiParam({ name: 'roomId', type: Number, description: '조회할 게임 방 ID' }) @ApiResponse({ status: 200, diff --git a/src/main.ts b/src/main.ts index bf7ee8b..3e0142e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,7 +15,7 @@ async function bootstrap() { origin: [ 'http://localhost:5173', 'http://localhost:3000', - 'https://api.davincicodegame.store', + 'https://davincicodegame.store', ], credentials: true, }); @@ -32,6 +32,7 @@ async function bootstrap() { type: 'http', scheme: 'bearer', bearerFormat: 'JWT', + in: 'header', }, 'access-token', )