code: private void refreshAccessToken() {
      final Long expiresIn = credential.getExpiresInSeconds();
  
      // trigger refresh if token is about to expire
      String accessToken = credential.getAccessToken();
      if (accessToken == null || expiresIn != null && expiresIn <= 60) {
        try {
          credential.refreshToken();
          accessToken = credential.getAccessToken();
        } catch (final IOException e) {
          log.error("Failed to fetch access token", e);
        }
      }
      if (accessToken != null) {
        this.accessToken = accessToken;
      }
    }
docs: Refresh the Google Cloud API access token, if necessary.