Skip to content

Commit

Permalink
Polish #7116
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrandja committed Aug 22, 2019
1 parent 2ddab8b commit f0515a0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
Expand Down Expand Up @@ -66,7 +67,8 @@ public Mono<OAuth2AccessTokenResponse> getTokenResponse(OAuth2RefreshTokenGrantR
.body(tokenRequestBody(refreshTokenGrantRequest))
.exchange()
.flatMap(response -> {
if (!response.statusCode().is2xxSuccessful()) {
HttpStatus status = HttpStatus.resolve(response.rawStatusCode());
if (status == null || !status.is2xxSuccessful()) {
OAuth2Error oauth2Error = new OAuth2Error(INVALID_TOKEN_RESPONSE_ERROR_CODE,
"An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: " +
"HTTP Status Code " + response.rawStatusCode(), null);
Expand Down

0 comments on commit f0515a0

Please sign in to comment.