Skip to content

Commit

Permalink
fix: 무한 호출 문제 해결
Browse files Browse the repository at this point in the history
- String을 body로 받지 않고 파라미터로 받게 함
  • Loading branch information
SJ70 committed Jul 23, 2024
1 parent eb4ce3e commit 8240b71
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/com/j9/bestmoments/controller/AuthController.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -47,16 +45,16 @@ public ResponseEntity<LoginDto> login(@PathVariable String registrationId, @Requ
return ResponseEntity.ok(jwtToken);
}

@PatchMapping("/logout")
@PatchMapping("/logout/{token}")
@Operation(summary = "로그아웃", description = "토큰을 강제로 만료시킵니다.")
public ResponseEntity<String> logout(@RequestBody String token) {
public ResponseEntity<String> logout(@PathVariable String token) {
tokenService.expire(token);
return ResponseEntity.ok().body("로그아웃에 성공하였습니다.");
}

@PatchMapping("/refresh")
@PatchMapping("/refresh/{refreshToken}")
@Operation(summary = "액세스토큰 재발급", description = "리프래시 토큰을 통해 재발급받습니다.")
public ResponseEntity<String> refreshToken(@RequestBody String refreshToken) {
public ResponseEntity<String> refreshToken(@PathVariable String refreshToken) {
String accessToken = tokenService.refresh(refreshToken);
return ResponseEntity.ok().body(accessToken);
}
Expand Down

0 comments on commit 8240b71

Please sign in to comment.