Skip to content

Commit

Permalink
Fix: kakao login 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
RinRinPARK committed Aug 8, 2024
1 parent 7afe78c commit c575227
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import com.swm_standard.phote.service.GoogleAuthService
import com.swm_standard.phote.service.KaKaoAuthService
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.beans.factory.annotation.Value
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.servlet.view.RedirectView

@RestController
@RequestMapping("/api/auth")
Expand All @@ -20,12 +18,6 @@ class AuthController(
private val googleAuthService: GoogleAuthService,
private val kaKaoAuthService: KaKaoAuthService,
) {
@Value("\${KAKAO_REST_API_KEY}")
lateinit var kakaokey: String

@Value("\${KAKAO_REDIRECT_URI}")
lateinit var kakaoRedirectUri: String

@Operation(summary = "google-login", description = "구글 로그인/회원가입")
@GetMapping("/google-login")
fun googleLogin(
Expand All @@ -40,18 +32,7 @@ class AuthController(

@Operation(summary = "kakao-login", description = "카카오 로그인/회원가입")
@GetMapping("/kakao-login")
fun kakaoLogin(): RedirectView {
val redirectView = RedirectView()
redirectView.url =
"https://kauth.kakao.com/oauth/authorize?response_type=code&" +
"client_id=$kakaokey&redirect_uri=$kakaoRedirectUri"

return redirectView
}

@Operation(summary = "kakao-login", description = "카카오 로그인 유저 정보 조회")
@GetMapping("/kakao-token")
fun getKakaoUserInfo(
fun kakaoLogin(
@RequestParam code: String,
): BaseResponse<UserInfoResponse> {
val accessToken = kaKaoAuthService.getTokenFromKakao(code)
Expand Down

0 comments on commit c575227

Please sign in to comment.