Skip to content

Commit

Permalink
Merge pull request #181 from APPS-sookmyung/dev
Browse files Browse the repository at this point in the history
[Feat] 로그인 url 추가
  • Loading branch information
ajung7038 authored Dec 24, 2024
2 parents 7bdefc6 + 3f6d006 commit 91075e2
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.net.URI;
import java.time.LocalDateTime;

@Slf4j
Expand All @@ -45,9 +46,23 @@ public class KakaoLoginController {
@Value("${cors.allowed.origin}")
private String frontendUrl;

// application.yml에서 client_id와 redirect_uri 값을 불러오기
@Value("${kakao.client_id}")
private String clientId;

@Value("${kakao.redirect_uri}")
private String redirectUri;

@GetMapping("/login")
public void login(HttpServletResponse response) throws IOException {
response.sendRedirect(loginUrl);
String location = "https://kauth.kakao.com/oauth/authorize?response_type=code"
+ "&client_id=" + clientId
+ "&redirect_uri=" + redirectUri;
URI uri = URI.create(location);
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri);

response.sendRedirect(location);
}


Expand Down

0 comments on commit 91075e2

Please sign in to comment.