Skip to content

Instantly share code, notes, and snippets.

View cykl's full-sized avatar

Clément MATHIEU cykl

View GitHub Profile
@michmzr
michmzr / CustomErrorDecoder.java
Created October 24, 2019 13:41
Reauthentificate oauth2 token when refresh token is expired, access token revoked. Implementation for Feign Client plugin
@Slf4j
public class CustomErrorDecoder implements ErrorDecoder {
@Autowired
FeignRequestInterceptor feignRequestInterceptor;
@Override
public Exception decode(String methodKey, Response response) {
log.debug("Catched Feign client error {}, {}", methodKey, response);
FeignException exception = errorStatus(methodKey, response);