adobe / aio-cli-plugin-aem-rde

Apache License 2.0
4 stars 13 forks source link

AccessToken is always stored in global config below the IMS context #95

Open kwin opened 1 month ago

kwin commented 1 month ago

When using a local .aio config like recommended in https://github.com/adobe/aio-cli-plugin-aem-rde?tab=readme-ov-file#getting-started

Note: Working with multiple environments: it is highly recommended to use the local storage. For details on different config locations refer to aio-lib-core-config's README. However, the default is to use global for users who have one environment only.

I expect that the accessToken which is retrieved is also stored locally, however this is persisted in the global aio config due to https://github.com/adobe/aio-lib-ims/issues/67 like this.

ims: {
    contexts: {
      aio-cli-plugin-cloudmanager: {
       ... 
       // duplicated service credentials from the local .aoi file
        ...
        access_token: {
          token: "<mytoken>,
          expiry: ...
        }
      },

In order to be able to easily switch between different credentials/organization just using the local AIO config (https://github.com/adobe/aio-lib-core-config/tree/master?tab=readme-ov-file#project-configuration) is not enough. Instead one currently has to use dedicated/unique IMS context names, however due to https://github.com/adobe/aio-cli-plugin-aem-rde/issues/20 this is not supported yet.

Please document that limitation in the readme and try to fix the upstream bug in https://github.com/adobe/aio-lib-ims/issues/67.

kwin commented 1 month ago

Currently as the default IMS context name is even shared with aio-cli-plugin-cloudmanager using both CLI plugins in parallel on different accounts does not work.

kwin commented 4 weeks ago

@RemoLiechti This issue prevents using RDE CLI tool in multi-tenant environments (like CI/CD tools or just poor developers having to deal with different programs and leveraging service authentication). Do you know of any workaround or can you give some ETA until multiple IMS context names are supported?

RemoLiechti commented 4 weeks ago

Hi @kwin , I am not aware of a workaround regarding the IMS config, but will talk to my colleagues of the IMS/cloudmanager plugins and come back to you. To make things easier in CIDI, did you see that we now can pass org/program/env as parameters to all commands? See https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/developing/rapid-development-environments#global-flags however, the token still remains an issue for you.

RemoLiechti commented 4 weeks ago

Currently as the default IMS context name is even shared with aio-cli-plugin-cloudmanager using both CLI plugins in parallel on different accounts does not work.

Yes, this is the case because some functionality like the aio aem rde reset command use the cloudmanager api. Hence we need to use that context name. I will also check this with the cloudmanager team.

kwin commented 4 weeks ago

Yes, this is the case because some functionality like the aio aem rde reset command use the cloudmanager api. Hence we need to use that context name.

I think this is a misunderstanding. Each tool should use a dedicated IMS name by default (to prevent overwriting IMS related config of another tool).