public Credential refreshCredential(Credential credential) throws IOException {
    TokenResponse tokenResponse = new RefreshTokenRequest(httpTransport, jsonFactory,
        new GenericUrl(credential.getTokenServerEncodedUrl()),
        credential.getRefreshToken())
        .setClientAuthentication(credential.getClientAuthentication())
        .setRequestInitializer(credential.getRequestInitializer()).execute();

    return credential.setFromTokenResponse(tokenResponse);
  }
Refreshes and updates the given credential
extensions/data-transfer/portability-data-transfer-microsoft/src/main/java/org/datatransferproject/transfer/microsoft/common/MicrosoftCredentialFactory.java