diff --git a/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/CreateCollectionCommandResolver.java b/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/CreateCollectionCommandResolver.java index fd1bdb1de1..75f70d873a 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/CreateCollectionCommandResolver.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/service/resolver/model/impl/CreateCollectionCommandResolver.java @@ -349,14 +349,16 @@ private void validateAuthentication( throw ErrorCode.VECTORIZE_INVALID_SHARED_KEY_VALUE_FORMAT.toApiException( "providerKey value should be formatted as '[keyName].providerKey'"); } + String providerKeyString = sharedKeyValue.substring(dotIndex + 1); if (!"providerKey".equals(providerKeyString)) { throw ErrorCode.VECTORIZE_INVALID_SHARED_KEY_VALUE_FORMAT.toApiException( "providerKey value should be formatted as '[keyName].providerKey'"); } } - if (operationsConfig.enableEmbeddingGateway()) + if (operationsConfig.enableEmbeddingGateway()) { validateCredentials.validate(userConfig.provider(), userAuth.getValue()); + } } } }