Skip to content

Commit

Permalink
Merge pull request #1 from 1223v/phone
Browse files Browse the repository at this point in the history
Feat: 전화번호 추가 및 카카오 properties oauth 수정
  • Loading branch information
1223v authored Nov 19, 2023
2 parents 1eae74f + 29a6cf9 commit 4e66567
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.readyvery.readyverydemo.domain.CeoInfo;
import com.readyvery.readyverydemo.domain.Role;
import com.readyvery.readyverydemo.domain.SocialType;
import com.readyvery.readyverydemo.domain.UserInfo;
import com.readyvery.readyverydemo.security.oauth2.userinfo.KakaoOAuth2UserInfo;
import com.readyvery.readyverydemo.security.oauth2.userinfo.OAuth2UserInfo;

Expand Down Expand Up @@ -59,6 +58,7 @@ public CeoInfo toEntity(SocialType socialType, OAuth2UserInfo oauth2UserInfo) {
.socialType(socialType)
.socialId(oauth2UserInfo.getId())
.email(oauth2UserInfo.getEmail())
.phone(oauth2UserInfo.getPhoneNumber())
.nickName(oauth2UserInfo.getNickName())
.imageUrl(oauth2UserInfo.getImageUrl())
.role(Role.USER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,15 @@ public String getEmail() {

return (String)account.get("email");
}

@Override
public String getPhoneNumber() {
Map<String, Object> account = (Map<String, Object>)attributes.get("kakao_account");

if (account == null) {
return null;
}

return (String)account.get("phone_number");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public OAuth2UserInfo(Map<String, Object> attributes) {
public abstract String getImageUrl();

public abstract String getEmail();

public abstract String getPhoneNumber();
}
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spring.security.oauth2.client.registration.kakao.client-secret=ZqqGiBCxPZD6BPLk0
spring.security.oauth2.client.registration.kakao.redirect-uri=http://localhost:8080/login/oauth2/code/kakao
spring.security.oauth2.client.registration.kakao.client-authentication-method=client_secret_post
spring.security.oauth2.client.registration.kakao.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.kakao.scope=profile_nickname, profile_image, account_email
spring.security.oauth2.client.registration.kakao.scope=profile_nickname, profile_image, account_email, phone_number
spring.security.oauth2.client.registration.kakao.client-name=Kakao
spring.security.oauth2.client.provider.kakao.authorization-uri=https://kauth.kakao.com/oauth/authorize
spring.security.oauth2.client.provider.kakao.token-uri=https://kauth.kakao.com/oauth/token
Expand Down

0 comments on commit 4e66567

Please sign in to comment.