Unable to change Commercetools scope config

Please fill out as many of the following questions as possible so we can help you promptly! If you don’t know how to answer or it does not apply, feel free to remove it or leave it blank.

Builder content link

Detailed steps to reproduce the bug

  • Go to Builder.io: Drag and drop page builder and CMS and enable Commercetools
  • in Commercetools, create a Client API key, and manually copy the details across to Builder.io into the applicable fields to configure the Commercetools integration
  • Click “Connect your commerce tools API”
  • Go back into the config for the Commercetools integration and modify the “Scopes” value, then click “Connect your commercetools API” button again.
    The old value is used, not the new value

I’ve tried disabling the integration and re-enabling it, and clearing out all my browser cookies/storage/etc and updating the Scopes field, but the value I paste in is not what Builder.io is using to make the call to Commercetools to fetch a token.

This may be a config issue on my part, but I can’t find any detailed documentation for configuring the Commercetools integration, other than https://github.com/BuilderIO/builder/tree/main/plugins/commercetools which doesn’t describe the config steps.

Screenshots or video link

I’m wondering if the view_products scope is hardcoded and the content of the “Scopes” config field isn’t used, or is used for something other than the REST call to Commercetools to get the token

The token scope is hardcoded: builder/plugin.ts at df171789e5227e24f51fcbe7e82e2c73b47bb7f2 · BuilderIO/builder · GitHub

Is the “Scopes” config field used for anything?

Aziz fixed this as part of PR github /BuilderIO/builder/pull/759 (this forum prohibits posting links to github, hence the mangled url)

If provided. the Scopes field value is now used in the token request to Commercetools otherwise it defaults to the scope “view_products:${projectKey}”.

However the Scopes field is still defined as

      {
        name: 'scopes',
        type: 'string',
        required: true,
      }

so its mandatory to provide a value.

1 Like