Skip to content

Commit

Permalink
TASK-200 카카오 로그인시 userName 쿼리 파라미터로 넘김
Browse files Browse the repository at this point in the history
  • Loading branch information
bjh3311 committed Aug 17, 2024
1 parent 0983199 commit beeef77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public ResponseEntity<Void> kakaoCallBack(@RequestParam("code") String code){

String queryParams = "accessToken=" + accessToken;
String userId = "&userId=" + jwtTokenProvider.getUserId(accessToken);
String userName = "&userName=" + map.get("userName");

// URL에 쿼리 파라미터 추가
String fullRedirectUrl = this.redirectUrl+"?" + queryParams + userId;
String fullRedirectUrl = this.redirectUrl+"?" + queryParams + userId + userName;

HttpHeaders headers = new HttpHeaders();
headers.setLocation(URI.create(fullRedirectUrl));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/newCar/event_page/service/OAuthServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public Map<String,String> getUserInfo(String kakaoAccessToken){
String nickname = properties.getAsJsonObject().get("nickname").getAsString();
String email = kakaoAccount.getAsJsonObject().get("email").getAsString();

userInfo.put("nickname", nickname);
userInfo.put("email", email);
userInfo.put("nickname", nickname);//카카오 토큰을 통해 얻은 닉네임
userInfo.put("email", email);//카카오 토큰을 통해 얻은 카카오이메일

br.close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public Map<String,String> kakaoLogin(Map<String,String> userInfo){
//유저가 없다면, UserDB에 저장을 해주어야 한다

map.put("accessToken", jwtTokenProvider.generateUserToken(userName));
map.put("userName",userInfo.get("nickname"));

return map;
}
Expand Down

0 comments on commit beeef77

Please sign in to comment.