code: public Credentials getScopedCredentials() {
      Credentials credentialsToReturn = credentials;
      if (credentials instanceof GoogleCredentials
          && ((GoogleCredentials) credentials).createScopedRequired()) {
        credentialsToReturn = ((GoogleCredentials) credentials).createScoped(getScopes());
      }
      return credentialsToReturn;
    }
docs: Returns the authentication credentials. If required, credentials are scoped.