Skip to content

Commit

Permalink
Merge pull request #72 from Developer-Wikis/feature/#62
Browse files Browse the repository at this point in the history
Fix : 소셜로그인 url 받는 api 수정
  • Loading branch information
jhdl0157 authored Oct 27, 2022
2 parents e3d4892 + baa6b7c commit 5372d00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public ResponseEntity<GoogleResponseDto> getGoogleUserInfo(@RequestParam("code")
GoogleResponseDto GoogleUser = oauthService.oAuthLogin(code,redirectUrl);
return new ResponseEntity<>(GoogleUser, HttpStatus.OK);
}
@GetMapping("/google/url")
public void getGoogleUrl(@RequestParam String url, HttpServletResponse response) throws IOException {
System.out.println("asdasdasd"+url);
@GetMapping("/google")
public ResponseEntity<String> getGoogleUrl(@RequestParam String url, HttpServletResponse response) throws IOException {
String redirectUrl=oauthService.googleUrl(url);
response.sendRedirect(redirectUrl);
//response.sendRedirect(redirectUrl);
return ResponseEntity.ok(redirectUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public ResponseEntity<String> requestAccessToken(String code,String redirectUrl)
return responseEntity;
}catch (RestClientException e){
e.printStackTrace();
throw new BadRequestException(String.format("인가코드로 구글의 AccessToken을 발급하지 못했습니다. code : %s, redirectUrl : %s",code,redirectUrl));
throw new BadRequestException(String.format("인가코드로 구글의 AccessToken을 발급하지 못했습니다. code : %s, redirectUrl : %s, 오류 내용 : %s",code,redirectUrl,e.getMessage()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class OauthService {
private final TokenService tokenService;
private final UserRepository userRepository;
public GoogleResponseDto oAuthLogin(String code, String redirectUrl) throws IOException {
ResponseEntity<String> accessTokenResponse= googleOauthService.requestAccessToken(code, UrlConverter.of(redirectUrl));
ResponseEntity<String> accessTokenResponse= googleOauthService.requestAccessToken(code, redirectUrl);
GoogleOAuthToken oAuthToken=googleOauthService.getAccessToken(accessTokenResponse);
ResponseEntity<String> userInfoResponse=googleOauthService.requestUserInfo(oAuthToken);
GoogleUser googleUser= googleOauthService.getUserInfo(userInfoResponse);
Expand Down

0 comments on commit 5372d00

Please sign in to comment.