Source:
AuthenticationResult acquireTokenWithRefreshToken(final String refreshToken) throws AuthenticationException { Logger.v(TAG, "Try to get new access token with the found refresh token.", mAuthRequest.getLogInfo(), null); HttpWebRequest.throwIfNetworkNotAvaliable(mContext); final AuthenticationResult result; try { final JWSBuilder jwsBuilder = new JWSBuilder(); final Oauth2 oauthRequest = new Oauth2(mAuthRequest, mWebRequestHandler, jwsBuilder); result = oauthRequest.refreshToken(refreshToken); if (result != null && StringExtensions.IsNullOrBlank(result.getRefreshToken())) { Logger.i(TAG, "Refresh token is not returned or empty", ""); result.setRefreshToken(refreshToken); } } catch (final IOException | AuthenticationException exc) { if (exc instanceof AuthenticationException && ((AuthenticationException) exc).getCode().equals(ADALError.SERVER_ERROR_FOR_RETRY) && mOutageModeIsOn) { final TokenCacheItem accessTokenItem = mTokenCacheAccessor.getRegularRefreshTokenCacheItem(mAuthRequest.getResource(), mAuthRequest.getClientId(), mAuthRequest.getUserFromRequest()); if (accessTokenItem.getAccessToken() != null && accessTokenItem.getExtendedExpiresOn() != null &&! TokenCacheItem.isTokenExpired(accessTokenItem.getExtendedExpiresOn())) { accessTokenItem.setExpiresOn(accessTokenItem.getExtendedExpiresOn()); final AuthenticationResult retryResult = AuthenticationResult.createResult(accessTokenItem); retryResult.setIsExtendedLifeTimeToken(true); return retryResult; } } Logger.e(TAG, "Error in refresh token for request:" + mAuthRequest.getLogInfo(), ExceptionExtensions.getExceptionMessage(exc), ADALError.AUTH_FAILED_NO_TOKEN, exc); throw new AuthenticationException( ADALError.AUTH_FAILED_NO_TOKEN, ExceptionExtensions.getExceptionMessage(exc), exc); } return result; }

Target:
AuthenticationResult acquireTokenWithRefreshToken(final String refreshToken) throws AuthenticationException { Logger.v(TAG, "Try to get new access token with the found refresh token.", mAuthRequest.getLogInfo(), null); HttpWebRequest.throwIfNetworkNotAvaliable(mContext); final AuthenticationResult result; try { final JWSBuilder jwsBuilder = new JWSBuilder(); final Oauth2 oauthRequest = new Oauth2(mAuthRequest, mWebRequestHandler, jwsBuilder); result = oauthRequest.refreshToken(refreshToken); if (result != null && StringExtensions.IsNullOrBlank(result.getRefreshToken())) { Logger.i(TAG, "Refresh token is not returned or empty", ""); result.setRefreshToken(refreshToken); } } catch (final ServerRespondingWithRetryableException exc) { Logger.i(TAG, "The server is not responding after the retry with error code: " + exc.getCode(), ""); final TokenCacheItem accessTokenItem = mTokenCacheAccessor.getStaleToken(mAuthRequest); if (accessTokenItem != null) { final AuthenticationResult retryResult = AuthenticationResult.createExtendedLifeTimeResult(accessTokenItem); Logger.i(TAG, "The result with stale access token is returned.", ""); return retryResult; } Logger.e(TAG, "Error in refresh token for request:" + mAuthRequest.getLogInfo(), ExceptionExtensions.getExceptionMessage(exc), ADALError.AUTH_FAILED_NO_TOKEN, new AuthenticationException(ADALError.SERVER_ERROR, exc.getMessage())); throw new AuthenticationException( ADALError.AUTH_FAILED_NO_TOKEN, ExceptionExtensions.getExceptionMessage(exc), new AuthenticationException(ADALError.SERVER_ERROR, exc.getMessage())); } catch (final IOException | AuthenticationException exc) { Logger.e(TAG, "Error in refresh token for request:" + mAuthRequest.getLogInfo(), ExceptionExtensions.getExceptionMessage(exc), ADALError.AUTH_FAILED_NO_TOKEN, new AuthenticationException(ADALError.SERVER_ERROR, exc.getMessage())); throw new AuthenticationException( ADALError.AUTH_FAILED_NO_TOKEN, ExceptionExtensions.getExceptionMessage(exc), new AuthenticationException(ADALError.SERVER_ERROR, exc.getMessage())); } return result; }