Skip to content

Commit

Permalink
Merge pull request #174 from YogitTeam/feat/user-profile
Browse files Browse the repository at this point in the history
#8 feat : 유저 회원가입 - access token, expire_in 추가
  • Loading branch information
shinhn authored Mar 24, 2023
2 parents a0abf28 + be91b3b commit 4c97f1f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public TokenResponse requestCodeValidations(ServicesResponse serviceResponse, St
tokenResponse = appleUtils.validateAuthorizationGrantCode(client_secret, code);

// 유저 생성
CreateUserAppleReq createUserAppleReq = new CreateUserAppleReq(email, tokenResponse.getRefresh_token(),null, UserType.APPLE);
CreateUserAppleReq createUserAppleReq = new CreateUserAppleReq(email, tokenResponse.getRefresh_token(), null, UserType.APPLE, tokenResponse.getAccess_token(), tokenResponse.getExpires_in());
saveduser = userService.createUserApple(createUserAppleReq);
}
// 이미 refresh 토큰 있는 유저면 client_secret, refresh_token로 검증
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public class CreateUserAppleReq {
String refreshToken;
String name;
UserType userType;
String access_token;
Long expires_in;

public static User toEntityUserApple(CreateUserAppleReq createUserAppleReq){
User user = new User(createUserAppleReq.loginId, createUserAppleReq.refreshToken, createUserAppleReq.name, createUserAppleReq.userType);
User user = new User(createUserAppleReq.loginId, createUserAppleReq.refreshToken, createUserAppleReq.name, createUserAppleReq.userType, createUserAppleReq.access_token, createUserAppleReq.expires_in);
return user;
}
}
6 changes: 5 additions & 1 deletion server/src/main/java/com/yogit/server/user/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class User extends BaseEntity {
private String nationality;

private String refreshToken;
private String access_token;
private Long expires_in;

@Enumerated(EnumType.STRING)
private UserStatus userStatus;
Expand Down Expand Up @@ -107,13 +109,15 @@ public User (String loginId, String refreshToken, String name){
this.reportedCnt=0;
}

public User (String loginId, String refreshToken, String name, UserType userType){
public User (String loginId, String refreshToken, String name, UserType userType, String access_token, Long expires_in){
this.loginId = loginId;
this.refreshToken = refreshToken;
this.name = name;
this.userType = userType;
this.reportingCnt=0;
this.reportedCnt=0;
this.access_token = access_token;
this.expires_in = expires_in;
}

public void addLanguage(Language language){
Expand Down

0 comments on commit 4c97f1f

Please sign in to comment.