From cdb0920d2a0add3557fe248880e64d2c17c603c6 Mon Sep 17 00:00:00 2001 From: daeunkwak Date: Sun, 17 Sep 2023 23:38:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/gangdan/please/api/OauthLoginController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/app/gangdan/please/api/OauthLoginController.java b/src/main/java/app/gangdan/please/api/OauthLoginController.java index 3fb77e8..2501640 100644 --- a/src/main/java/app/gangdan/please/api/OauthLoginController.java +++ b/src/main/java/app/gangdan/please/api/OauthLoginController.java @@ -2,6 +2,7 @@ import app.gangdan.please.domain.member.constant.SocialType; import app.gangdan.please.dto.member.jwt.ResponseJwtTokenDto; +import app.gangdan.please.global.exception.BadRequestException; import org.apache.commons.lang3.EnumUtils; import app.gangdan.please.service.oauth.OauthLoginService; import io.swagger.v3.oas.annotations.Operation; @@ -39,7 +40,13 @@ public ResponseEntity loginOauth(HttpServletRequest httpSer final SocialType socialType = SocialType.GOOGLE; - final ResponseJwtTokenDto jwtTokenDto = oauthLoginService.googleLoginV2(httpServletRequest.getHeader(HttpHeaders.AUTHORIZATION)); + final String tokenString = httpServletRequest.getHeader(HttpHeaders.AUTHORIZATION); + + if (tokenString == null || tokenString.isEmpty()) { + throw new BadRequestException("토큰이 없습니다."); + } + + final ResponseJwtTokenDto jwtTokenDto = oauthLoginService.googleLoginV2(tokenString); log.info("=== Oauth login end ==="); return ResponseEntity.ok(jwtTokenDto);