Skip to content

Commit

Permalink
πŸš€ :: Api-v0.0.2-1
Browse files Browse the repository at this point in the history
πŸš€ :: Api-v0.0.2-1
  • Loading branch information
ImNM authored Jan 10, 2023
2 parents 10b2d93 + 7d46fd1 commit 407ab85
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
Expand All @@ -33,6 +34,7 @@
@RestController
@RequestMapping("/v1/auth")
@RequiredArgsConstructor
@Slf4j
@Tag(name = "인증 κ΄€λ ¨ 컨트둀러")
public class AuthController {

Expand All @@ -58,17 +60,23 @@ public OauthLoginLinkResponse getKakaoOauthLink() {
@GetMapping("/oauth/kakao")
public void getCredentialFromKaKao(
@RequestParam("code") String code,
@RequestHeader(value = "host") String host,
@RequestHeader(value = "referer", required = false) String referer,
@RequestHeader(value = "host", required = false) String host,
HttpServletResponse response)
throws IOException {
OauthTokenResponse credentialFromKaKao = registerUseCase.getCredentialFromKaKao(code);
log.info(referer);
String queryString =
String.format(
"?idToken=%s&accessToken=%s&refreshToken=%s",
credentialFromKaKao.getIdToken(),
credentialFromKaKao.getAccessToken(),
credentialFromKaKao.getRefreshToken());
response.sendRedirect("http://" + host + "/kakao/callback" + queryString);
if (referer != null) {
response.sendRedirect(referer + "/kakao/callback" + queryString);
} else {
response.sendRedirect("https://" + host + "/kakao/callback" + queryString);
}
}

@Operation(summary = "개발용 νšŒμ›κ°€μž…μž…λ‹ˆλ‹€ ν΄λΌμ΄μ–ΈνŠΈκ°€ λͺ°λΌλ„ λ©λ‹ˆλ‹€.", deprecated = true)
Expand Down

0 comments on commit 407ab85

Please sign in to comment.