Overview
This step-by-step guide outlines how to update your connect.yaml
configuration file to automatically generate API Client credentials.
Requirements
Before you begin, ensure you have the following:
- An existing Connector that uses
connect.yaml
for configuration. - Access to the Composable Commerce API and the necessary credentials.
Update your configuration file
To enable automatic generation of API credentials, update your connect.yaml
configuration file.
To prevent configuration conflicts, ensure that the connect.yaml
file does not include any variables that will be automatically generated by the API Client generation feature. These autogenerated variables are provided at runtime and should not be manually defined in the configuration.
The following example shows a connect.yaml
file with pre-generated Composable Commerce credentials.
With this configuration file, API Client will not be generated automatically.
deployAs:
- name: service_app_name
applicationType: service
endpoint: /service
scripts:
postDeploy: npm run connector:post-deploy
preUndeploy: npm run connector:pre-undeploy
configuration:
standardConfiguration:
- key: CTP_PROJECT_KEY
description: Project key of the commercetools Composable Commerce Project
required: true
default: 'default-key'
securedConfiguration:
- key: INTEGRATION_API_KEY
description: API key for the integration
required: true
- key: CTP_CLIENT_ID
description: commercetools Composable Commerce client ID
required: true
- key: CTP_CLIENT_SECRET
description: commercetools Composable Commerce client secret
required: true
- key: CTP_SCOPE
description: commercetools Composable Commerce client scope
- name: job_app_name
applicationType: job
endpoint: /job
properties:
schedule: '*/5 * * * *'
configuration:
standardConfiguration:
- key: CTP_PROJECT_KEY
description: Project key of the commercetools Composable Commerce Project
required: true
securedConfiguration:
- key: INTEGRATION_API_KEY
description: API key for the integration
required: true
- key: CTP_CLIENT_ID
description: commercetools Composable Commerce client ID
required: true
- key: CTP_CLIENT_SECRET
description: commercetools Composable Commerce client secret
required: true
- key: CTP_SCOPE
description: commercetools Composable Commerce client scope
To enable automatic API Client generation, complete the following steps in your connect.yaml
file:
- In the
standardConfiguration
object, remove theCTP_PROJECT_KEY
variable with the Composable Commerce project key: this key will be fetched automatically. - In the
securedConfiguration
object, remove the variables with pre-generated Composable Commerce credentials:CTP_CLIENT_ID
,CTP_CLIENT_SECRET
, andCTP_SCOPE
. - Add an
inheritAs
object and specify the scopes to include for automatically generated API Client credentials as a list ininheritAs.apiClient.scopes
, for examplemanage_payments
,manage_orders
,manage_extenstions
(only for service application types that use API Extensions), andmanage_subscriptions
(only for event application types that use Subscriptions).
The resulting example connect.yaml
looks as follows:
deployAs:
- name: service_app_name
applicationType: service
endpoint: /service
scripts:
postDeploy: npm run connector:post-deploy
preUndeploy: npm run connector:pre-undeploy
configuration:
securedConfiguration:
- key: INTEGRATION_API_KEY
description: API key for the integration
required: true
- name: job_app_name
applicationType: job
endpoint: /job
properties:
schedule: '*/5 * * * *'
configuration:
securedConfiguration:
- key: INTEGRATION_API_KEY
description: API key for the integration
required: true
inheritAs:
apiClient:
scopes:
- manage_payments
- manage_orders
- manage_subscriptions # only for event application types that use Subscriptions
- manage_extensions # only for service application types that use API Extensions
Variables available in the Connect application
With the automatic generation of API Client credentials, the following environment variables will be available for your Connector:
Field | Description |
---|---|
CTP_API_URL | Composable Commerce API URL. |
CTP_AUTH_URL | Authentication URL for the Composable Commerce API. |
CTP_CLIENT_ID | API Client ID for the Connector. |
CTP_PROJECT_KEY | Composable Commerce Project key. |
CTP_CLIENT_SECRET | Secret key associated with the Composable Commerce API Client. |
CTP_SCOPE | List of scopes assigned to the API credentials. |