Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #583 Success result is returned even light-oauth2 returns an er… #585

Merged
merged 1 commit into from
Jul 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,11 @@ private static Result<TokenResponse> handleResponse(ContentType contentType, Str
}
if (responseBody != null && responseBody.length() > 0) {
tokenResponse = Config.getInstance().getMapper().readValue(responseBody, TokenResponse.class);
if(tokenResponse != null) {
// sometimes, the token response contains an error status instead of the access token.
if(tokenResponse != null && tokenResponse.getAccessToken() != null) {
result = Success.of(tokenResponse);
} else {
result = Failure.of(new Status(GET_TOKEN_ERROR, responseBody));
result = Failure.of(new Status(tokenResponse.getStatusCode(), tokenResponse.getCode(), tokenResponse.getMessage(), tokenResponse.getDescription(), tokenResponse.getSeverity()));
}
} else {
result = Failure.of(new Status(GET_TOKEN_ERROR, "no auth server response"));
Expand Down