Expand my Community achievements bar.

SOLVED

Code: CANNOT_GENERATE_TOKEN

Avatar

Level 2

Hello,

I'm trying to generate a Cloud Manage API access token to eventually automate some Adobe I/O CLI commands. This automation will eventually be run from AWS Lambda to send AEM access logs to AWS S3 so we will not be able to authenticate manually.

Eventual commands to automate at minimum:

Using this Github content to setup authentication:

Using Service Account Authentication, not Browser-based.

https://github.com/adobe/aio-cli-plugin-cloudmanager/blob/main/README.md

Adobe I/O CLI already installed.

 

I've setup a (JWT) Service Account with a Cloud Manager API and generated a private/public key pair. 

I've updated the relevant values from the JWT service account in a config.json file as described.

 

//config.json 
{
  "client_id": "value from your CLI integration (String)",
  "client_secret": "value from your CLI integration (String)",
  "technical_account_id": "value from your CLI integration (String)",
  "ims_org_id": "value from your CLI integration (String)",
  "meta_scopes": [
    "ent_cloudmgr_sdk"
  ]
}

 

I have the config.json and private.key files in my local directory.

 

I've run these commands to set the cloud manager credentials:

aio config:set jwt-auth config.json --file --json

aio config:set jwt-auth.jwt_private_key private.key --file

aio config:set cloudmanager_programid PROGRAMID


When I attempt to run any of the aio commands that need to authenticate, it is not able to generate the access token.:

 

 

$ LOG_LEVEL=debug aio cloudmanager:list-programs
2023-08-13T15:37:45.252Z [@adobe/aio-cli-plugin-cloudmanager:migrate-jwt-context-hook] debug: start jwt-auth migration hook
2023-08-13T15:37:45.256Z [@adobe/aio-cli-plugin-cloudmanager:migrate-jwt-context-hook] debug: New IMS configuration detected in global. No need to migrate.
2023-08-13T15:37:45.256Z [@adobe/aio-cli-plugin-cloudmanager:migrate-jwt-context-hook] debug: end jwt-auth migration hook
2023-08-13T15:37:45.449Z [@adobe/aio-lib-env] debug: supported envs: ["prod","stage"]
2023-08-13T15:37:45.449Z [@adobe/aio-lib-env] debug: default env: prod
2023-08-13T15:37:45.449Z [@adobe/aio-lib-env] debug: config key to check for env: cli.env
2023-08-13T15:37:45.449Z [@adobe/aio-lib-env] debug: config key value set for env: undefined
 ›   Error: [IMSSDK:CANNOT_GENERATE_TOKEN] Cannot generate token because no plugin 
 ›   supports configuration:
 ›   [plugin:cli]: [IMSOAuthSDK:MISSING_PROPERTIES] OAuth2 not supported due to some 
 ›   missing properties: cli.bare-output
 ›   [plugin:jwt]: [IMSJWTSDK:MISSING_PROPERTIES] JWT not supported due to some 
 ›   missing properties: private_key
 ›   [plugin:oauth]: [IMSOAuthSDK:MISSING_PROPERTIES] OAuth2 not supported due to 
 ›   some missing properties: scope
 ›   Code: CANNOT_GENERATE_TOKEN

 

 

Any help or guidance is appreciated.

TIA

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @earl5273 ,

 

Can you check if "aio-cli-plugin-cloudmanager" plugin is installed, you can verify it with typing "aio info". you should be able to see this in plugin list, if not then install it by following the instruction here:- 

https://github.com/adobe/aio-cli-plugin-cloudmanager 

 

If this is not the case, then you can try to delete the aio config and try commands again, also validate the configurations it seems that the command line isn't able to retrieve the values set.

 

 

Hope that helps!

 

Regards,

Nitesh

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi @earl5273 ,

 

Can you check if "aio-cli-plugin-cloudmanager" plugin is installed, you can verify it with typing "aio info". you should be able to see this in plugin list, if not then install it by following the instruction here:- 

https://github.com/adobe/aio-cli-plugin-cloudmanager 

 

If this is not the case, then you can try to delete the aio config and try commands again, also validate the configurations it seems that the command line isn't able to retrieve the values set.

 

 

Hope that helps!

 

Regards,

Nitesh

Avatar

Level 2

@nitesh_kumar

Thank you for your help. With your recommendations (aio info) I was able to find that "aio-cli" was not installed globally and I was on an unsupported node version (v20). 

I installed node v18 and installed "aio-cli" globally (npm install -g @adobe/aio-cli).

Its working now.

Thank you!