사용자정보조회2
This commit is contained in:
@@ -11,7 +11,13 @@ import lombok.ToString;
|
|||||||
@Setter
|
@Setter
|
||||||
public class UserInfoInqyReqDTO {
|
public class UserInfoInqyReqDTO {
|
||||||
|
|
||||||
@JsonProperty("access_token")
|
class Request {
|
||||||
String access_token;
|
@JsonProperty("access_token")
|
||||||
|
String access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Properties {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,19 +6,32 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ToString
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class UserInfoInqyResDTO {
|
public class UserInfoInqyResDTO {
|
||||||
|
|
||||||
class Request {
|
class Response {
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
String id;
|
String id;
|
||||||
|
|
||||||
@JsonProperty("properties")
|
@JsonProperty("properties")
|
||||||
|
KakaoAccount account;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Properties {
|
class KakaoAccount {
|
||||||
|
PropertiesKeys keys;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PropertiesKeys {
|
||||||
|
String profile;
|
||||||
|
String name;
|
||||||
|
String email;
|
||||||
|
String age_range;
|
||||||
|
String birthday;
|
||||||
|
String gender;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -6,8 +6,8 @@ import org.springframework.web.reactive.function.BodyInserters;
|
|||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
||||||
import site.ocr.prd.dto.LoginRequestDto;
|
import site.ocr.prd.dto.LoginReqDTO;
|
||||||
import site.ocr.prd.dto.LoginResponseDto;
|
import site.ocr.prd.dto.LoginResDTO;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class LoginService {
|
public class LoginService {
|
||||||
@@ -18,10 +18,10 @@ public class LoginService {
|
|||||||
this.webClient = builder.build();
|
this.webClient = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginResponseDto getToken(LoginRequestDto request) {
|
public LoginResDTO getToken(LoginReqDTO request) {
|
||||||
System.out.println("kakao auth code = {}" + request.getCode());
|
System.out.println("kakao auth code = {}" + request.getCode());
|
||||||
|
|
||||||
LoginResponseDto result = webClient.post()
|
LoginResDTO result = webClient.post()
|
||||||
.uri("https://kauth.kakao.com/oauth/token")
|
.uri("https://kauth.kakao.com/oauth/token")
|
||||||
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=utf-8")
|
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE + ";charset=utf-8")
|
||||||
.body(BodyInserters.fromFormData("grant_type", "authorization_code")
|
.body(BodyInserters.fromFormData("grant_type", "authorization_code")
|
||||||
@@ -29,7 +29,7 @@ public class LoginService {
|
|||||||
.with("redirect_uri", "http://localhost:9001/oauth/oauth-kakao-authorize")
|
.with("redirect_uri", "http://localhost:9001/oauth/oauth-kakao-authorize")
|
||||||
.with("code", request.getCode()))
|
.with("code", request.getCode()))
|
||||||
.retrieve()
|
.retrieve()
|
||||||
.bodyToMono(LoginResponseDto.class)
|
.bodyToMono(LoginResDTO.class)
|
||||||
.block();
|
.block();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user