Skip to content

Commit

Permalink
fix: requestBody -> requestParams
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Jul 29, 2024
1 parent edd76bd commit 3228c04
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.hero.alignlab.client.kakao.SuspendableClient
import com.hero.alignlab.client.kakao.config.KakaoOAuthClientConfig
import com.hero.alignlab.client.kakao.model.request.GenerateKakaoOAuthTokenRequest
import com.hero.alignlab.client.kakao.model.response.GenerateKakaoOAuthTokenResponse
import org.springframework.http.MediaType
import org.springframework.web.reactive.function.client.WebClient

class SuspendableKakaoOAuthClient(
Expand All @@ -26,8 +25,15 @@ class SuspendableKakaoOAuthClient(
override suspend fun generateOAuthToken(request: GenerateKakaoOAuthTokenRequest): GenerateKakaoOAuthTokenResponse {
return client
.post()
.uri("/token")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.uri("/token") { builder ->
builder
.queryParam("grant_type", "authorization_code")
.queryParam("client_id", request.clientId)
.queryParam("redirect_uri", request.redirectUri)
.queryParam("code", request.code)
.queryParam("client_secret", request.clientSecret)
.build()
}
.bodyValue(request)
.request()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.hero.alignlab.domain.dev.application

import com.hero.alignlab.client.kakao.KakaoOAuthService
import com.hero.alignlab.client.kakao.config.KakaoOAuthClientConfig
import com.hero.alignlab.client.kakao.model.response.GenerateKakaoOAuthTokenResponse
import com.hero.alignlab.domain.auth.model.OAuthProvider
import com.hero.alignlab.domain.dev.model.response.DevOAuthCodeResponse
Expand All @@ -11,7 +10,6 @@ import org.springframework.stereotype.Service
@Service
class DevOAuthService(
private val kakaoOAuthService: KakaoOAuthService,
private val config: KakaoOAuthClientConfig.Config,
) {
private val logger = KotlinLogging.logger { }

Expand All @@ -25,7 +23,7 @@ class DevOAuthService(

suspend fun resolveOAuth(provider: OAuthProvider, code: String): GenerateKakaoOAuthTokenResponse {
return when (provider) {
OAuthProvider.kakao -> kakaoOAuthService.generateOAuthToken(code, config.redirectUrl)
OAuthProvider.kakao -> kakaoOAuthService.generateOAuthToken(code)
}
}
}

0 comments on commit 3228c04

Please sign in to comment.