private synchronized OAuth2DataGenerator getOrCreateAuthDataGenerator(
      DataVertical transferType, AuthMode mode) {
    Preconditions.checkState(initialized, "Cannot get OAuth2DataGenerator before initialization");
    Preconditions.checkArgument(
        mode == AuthMode.EXPORT
            ? getExportTypes().contains(transferType)
            : getImportTypes().contains(transferType));

    Map<DataVertical, OAuth2DataGenerator> generators =
        mode == AuthMode.EXPORT ? exportAuthDataGenerators : importAuthDataGenerators;

    if (!generators.containsKey(transferType)) {
      generators.put(
          transferType,
          new OAuth2DataGenerator(oAuth2Config, appCredentials, httpTransport, transferType, mode));
    }

    return generators.get(transferType);
  }
General implementation of an {@link AuthServiceExtension} for OAuth2. Largely exists to provide
the appropriate {@link OAuth2DataGenerator} upon request.
libraries/auth/src/main/java/org/datatransferproject/auth/OAuth2ServiceExtension.java