Hi, I am able to successfully create a Connect application deployment using the API as described here: https://docs.commercetools.com/connect/deployments#create-deployment
However, if I convert my connector to use automatically generated API client credentials (as described here: https://docs.commercetools.com/connect/modify-connector) then when I try and create a deployment I get a 403 Access denied error.
Details
I have an example open source connector that I created for another issue that I can use to demonstrate this issue: https://github.com/tcpl/commercetools-connector-undeploy-demo
Tag 1.4.1 uses explicit API credentials and tag 1.5.1 uses auto generated API credentials.
Create Connector
curl https://connect.europe-west1.gcp.commercetools.com/connectors/drafts -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"name" : "Connector API Test",
"creator" : {
"email" : "stephen.upchurch@thecommercepartnership.com"
},
"repository" : {
"url" : "git@github.com:tcpl/commercetools-connector-undeploy-demo.git",
"tag" : "1.4.1"
},
"privateProjects" : [],
"supportedRegions" : [ "europe-west1.gcp" ]
}
DATA
Publish Connector
curl https://connect.europe-west1.gcp.commercetools.com/connectors/drafts/0a7b631c-dfc9-427c-b8db-767cfdcfad32 -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version": 1,
"actions": [
{
"action": "publish",
"certification": false
}
]
}
DATA
Deploy Connector
curl "https://connect.europe-west1.gcp.commercetools.com/${PROJECT_ID}/deployments" -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"connector": {
"id": "0a7b631c-dfc9-427c-b8db-767cfdcfad32",
"version": 3,
"staged": false
},
"region": "europe-west1.gcp",
"configurations": [
{
"applicationName": "service",
"standardConfiguration": [
{ "key": "CTP_PROJECT_KEY", "value": "xxxx" },
{ "key": "CTP_CLIENT_ID", "value": "xxxx" },
{ "key": "CTP_AUTH_URL", "value": "https://auth.europe-west1.gcp.commercetools.com" },
{ "key": "CTP_API_URL", "value": "https://api.europe-west1.gcp.commercetools.com" }
],
"securedConfiguration": [
{ "key": "CTP_CLIENT_SECRET", "value": "xxxx" }
]
}
]
}
DATA
The create deployment command above works fine. However, if I now change the connector to use tag 1.5.1 it no longer works.
Update Connector to use Auto Generated Client (tag 1.5.1)
curl https://connect.europe-west1.gcp.commercetools.com/connectors/drafts/0a7b631c-dfc9-427c-b8db-767cfdcfad32 -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version": 1,
"actions": [
{
"action": "setRepository",
"url" : "git@github.com:tcpl/commercetools-connector-undeploy-demo.git",
"tag" : "1.5.1"
}
]
}
DATA
Publish Connector
curl https://connect.europe-west1.gcp.commercetools.com/connectors/drafts/0a7b631c-dfc9-427c-b8db-767cfdcfad32 -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version": 1,
"actions": [
{
"action": "publish",
"certification": false
}
]
}
DATA
Try Creating a Deployment for the Connector
curl "https://connect.europe-west1.gcp.commercetools.com/${PROJECT_ID}/deployments" -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"connector": {
"id": "0a7b631c-dfc9-427c-b8db-767cfdcfad32",
"version": 3,
"staged": false
},
"region": "europe-west1.gcp",
"configurations": [
{
"applicationName": "service",
"standardConfiguration": [],
"securedConfiguration": []
}
]
}
DATA
I get the following response:
{
"statusCode": 403,
"message": "Access denied",
"errors": [{ "code": "AuthorizationError", "message": "Access denied" }]
}
Any ideas on how I can use the API to create or update a deployment when using automatically generated API client credentials?
Thanks
Stephen