} else {
// We don't have an access token, we need to try and get one.
// First step see if we have a refresh token
if (BasicOAuth2Request.haveRefreshToken(accessor) != null) {
if (BasicOAuth2Request.checkCanRefresh()) {
final OAuth2HandlerError handlerError = this.refreshToken(accessor);
if (handlerError == null) {
// No errors refreshing, attempt the fetch again.
ret = this.attemptFetch(accessor, true);
} else {
// There was an error refreshing, stop.
final OAuth2Error error = handlerError.getError();
ret = this.getErrorResponseBuilder(handlerError.getCause(), error,
handlerError.getContextMessage(), "");
}
} else {
// User cannot refresh, they'll have to try to authorize again.
accessor.setRefreshToken(null);
ret = this.attemptFetch(accessor, true);