Skip to content

Commit

Permalink
Merge pull request #87 from Genti2024/fix/oauth-redirect-properties
Browse files Browse the repository at this point in the history
Fix: Oauth redirect url 프로퍼티 읽어오는 방식 수정
  • Loading branch information
LeeJae-H committed Jul 29, 2024
2 parents b05ac0a + e8d52ad commit 6e494ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public class GoogleOauthStrategy implements SocialLoginStrategy, SocialAuthStrat
private String googleClientSecret;
@Value("${google.redirect-url}")
private String googleRedirectUrl;
@Value("${server.domain}")
private String serverBaseUri;
@Value("${server.port}")
private String serverPort;

@Value("${google.scope}")
private List<String> scope;
Expand All @@ -58,7 +54,7 @@ public class GoogleOauthStrategy implements SocialLoginStrategy, SocialAuthStrat
public String getAuthUri() {
Map<String, Object> params = new HashMap<>();
params.put("client_id", googleClientId);
params.put("redirect_uri", serverBaseUri + ":" + serverPort + googleRedirectUrl);
params.put("redirect_uri", googleRedirectUrl);
params.put("response_type", "code");
params.put("scope", String.join("%20", scope));

Expand All @@ -75,7 +71,7 @@ public SocialLoginResponse webLogin(SocialLoginRequest request) {
request.getCode(),
googleClientId,
googleClientSecret,
serverBaseUri + ":" + serverPort + googleRedirectUrl,
googleRedirectUrl,
"authorization_code"
);
GoogleInfoResponse userResponse = googleApiClient.googleInfo("Bearer " + tokenResponse.accessToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ public class KakaoOauthStrategy implements SocialLoginStrategy, SocialAuthStrate
private String kakaoClientId;
@Value("${kakao.redirect-uri}")
private String kakaoRedirectUri;
@Value("${server.domain}")
private String serverBaseUri;
@Value("${server.port}")
private String serverPort;
@Value("${kakao.client-secret}")
private String kakaoClientSecret;

Expand All @@ -55,7 +51,7 @@ public class KakaoOauthStrategy implements SocialLoginStrategy, SocialAuthStrate
public String getAuthUri() {
Map<String, Object> params = new HashMap<>();
params.put("client_id", kakaoClientId);
params.put("redirect_uri", serverBaseUri + ":" + serverPort + kakaoRedirectUri);
params.put("redirect_uri", kakaoRedirectUri);
params.put("response_type", "code");

String paramStr = params.entrySet().stream()
Expand All @@ -71,7 +67,7 @@ public SocialLoginResponse webLogin(SocialLoginRequest request) {
"authorization_code",
kakaoClientId,
kakaoClientSecret,
serverBaseUri + ":" + serverPort + kakaoRedirectUri,
kakaoRedirectUri,
request.getCode()
);

Expand Down Expand Up @@ -112,7 +108,8 @@ private SocialLoginResponse getUserInfo(OauthPlatform oauthPlatform, String acce
.userId(user.getId().toString())
.role(user.getUserRole().getRoles())
.build();
OauthJwtResponse oauthJwtResponse = new OauthJwtResponse(jwtTokenProvider.generateAccessToken(tokenGenerateCommand),
OauthJwtResponse oauthJwtResponse = new OauthJwtResponse(
jwtTokenProvider.generateAccessToken(tokenGenerateCommand),
jwtTokenProvider.generateRefreshToken(tokenGenerateCommand), user.getUserRole().getStringValue());
return SocialLoginResponse.of(user.getId(), user.getUsername(), user.getEmail(), isNewUser, oauthJwtResponse);
}
Expand Down

0 comments on commit 6e494ff

Please sign in to comment.