79406681

Date: 2025-02-02 13:34:48
Score: 0.5
Natty:
Report link

I got around it without the circuit breaker by using a pattern like this:

return authorizedClientManager.authorize(oauth2Request)
        .map(authorizedClient -> exchange.mutate()
                .request(r -> r.headers(
                        headers -> headers.set(HttpHeaders.AUTHORIZATION,
                                "Bearer " + authorizedClient.getAccessToken().getTokenValue())))
                .build())
        .onErrorResume(e -> Mono.empty())  // Ignore the error
        .defaultIfEmpty(exchange)  // Then continue if an occurred, allowing routed request to fail with a 401
        .flatMap(chain::filter);
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: jlfeld1