Source:
private void refreshTokenWithoutCache(final String refreshToken, final String clientId, final String resource, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.setCorrelationId(getRequestCorrelationId()); Logger.v(TAG, "Refresh token without cache"); if (StringExtensions.IsNullOrBlank(refreshToken)) { throw new IllegalArgumentException("Refresh token is not provided"); } if (StringExtensions.IsNullOrBlank(clientId)) { throw new IllegalArgumentException("ClientId is not provided"); } if (externalCallback == null) { throw new IllegalArgumentException("Callback is not provided"); } final CallbackHandler callbackHandle = new CallbackHandler(getHandler(), externalCallback); sThreadExecutor.execute(new Runnable() { @Override public void run() { final URL authorityUrl = StringExtensions.getUrl(mAuthority); if (authorityUrl == null) { callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL)); return; } final AuthenticationRequest request = new AuthenticationRequest(mAuthority, resource, clientId, getRequestCorrelationId()); request.setSilent(true); final RefreshItem refreshItem = new RefreshItem(refreshToken); if (mValidateAuthority) { Logger.v(TAG, "Validating authority"); if (validateAuthority(authorityUrl)) { Logger.v(TAG, "Authority is validated" + authorityUrl.toString()); } else { Logger.v( TAG, "Call callback since instance is invalid:" + authorityUrl.toString()); callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_INSTANCE)); return; } } final AuthenticationResult authResult; try { authResult = getTokenWithRefreshToken(null, false, request, refreshItem, false); } catch (final AuthenticationException authException) { callbackHandle.onError(authException); return; } catch (final HttpResponseException httpResponseException) { final AuthenticationException authenticationException = new AuthenticationException( ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED, httpResponseException.getMessage()); return; } callbackHandle.onSuccess(authResult); } }); }

Target:
private void refreshTokenWithoutCache(final String refreshToken, final String clientId, final String resource, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.setCorrelationId(getRequestCorrelationId()); Logger.v(TAG, "Refresh token without cache"); if (StringExtensions.IsNullOrBlank(refreshToken)) { throw new IllegalArgumentException("Refresh token is not provided"); } if (StringExtensions.IsNullOrBlank(clientId)) { throw new IllegalArgumentException("ClientId is not provided"); } if (externalCallback == null) { throw new IllegalArgumentException("Callback is not provided"); } final CallbackHandler callbackHandle = new CallbackHandler(getHandler(), externalCallback); sThreadExecutor.execute(new Runnable() { @Override public void run() { final URL authorityUrl = StringExtensions.getUrl(mAuthority); if (authorityUrl == null) { callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL)); return; } final AuthenticationRequest request = new AuthenticationRequest(mAuthority, resource, clientId, getRequestCorrelationId()); request.setSilent(true); final RefreshItem refreshItem = new RefreshItem(refreshToken); if (mValidateAuthority) { Logger.v(TAG, "Validating authority"); if (validateAuthority(authorityUrl)) { Logger.v(TAG, "Authority is validated" + authorityUrl.toString()); } else { Logger.v( TAG, "Call callback since instance is invalid:" + authorityUrl.toString()); callbackHandle.onError(new AuthenticationException( ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_INSTANCE)); return; } } final AuthenticationResult authResult; try { authResult = getTokenWithRefreshToken(null, false, request, refreshItem, false); } catch (final AuthenticationException authException) { callbackHandle.onError(authException); return; } catch (final HttpResponseException httpResponseException) { final AuthenticationException authenticationException = new AuthenticationException( ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED, httpResponseException.getMessage()); callbackHandle.onError(authenticationException); return; } callbackHandle.onSuccess(authResult); } }); }