jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
519 stars 223 forks source link

Create the access token with the new access api endpoint instead of old artifactory endpoint when CLI is configured with username and password #2547

Open VJ-JFrog opened 1 month ago

VJ-JFrog commented 1 month ago

This is the feature request created for implementing the new access API endpoint while creating access token when the CLI is configured with username and password.

Currently, when the CLI is configured with username and password, the jf atc command will not create a token as only the access token for CLI configuration is allowed. Below is the output we get when execute jf atc command.

jf atc 16:30:55 [Debug] JFrog CLI version: 2.56.0 16:30:55 [Debug] OS/Arch: darwin/arm64 16:30:55 [🚨Error] authenticating with access token is currently mandatory for creating access tokens

We can create access token with jf rt atc command but it is using the old artifactory API for creating the tokens. Below is the sample output.

jf rt atc 16:52:07 [Debug] Usage Report: Sending info... 16:52:07 [Debug] Sending HTTP POST request to: https://JPD_URL/artifactory/api/security/token 16:52:07 [Debug] Sending HTTP GET request to: https://JPD_URL/artifactory/api/system/version 16:52:09 [Debug] Artifactory response: 200 16:52:09 [Debug] JFrog Artifactory version is: 7.XX 16:52:09 [Debug] Sending HTTP POST request to: https://JPD_URL/artifactory/api/system/usage

However, if we configure the CLI with an access token the jf atc command works fine and creates an access token accordingly. Below is the output.

jf atc
16:42:05 [Debug] JFrog CLI version: 2.56.0 16:42:05 [Debug] OS/Arch: darwin/arm64 16:42:05 [Debug] Usage Report: Sending info... 16:42:05 [Debug] Sending HTTP POST request to: https://JPD-URL/access/api/v1/tokens 16:42:05 [Debug] Sending HTTP GET request to: https://JPD-URL/artifactory/api/system/version 16:42:06 [Debug] Artifactory response: 200 16:42:06 [Debug] JFrog Artifactory version is: 7.XX 16:42:06 [Debug] Sending HTTP POST request to: https://JPD-URL/artifactory/api/system/usage { "scope": "applied-permissions/user", "access_token": "eyJ2ZXIiOiIyIiwidHlwIjo...............deu0RRGdMlJUb73-YiVJr6ASgnfrrjtIEpicGCEggxwYxNV4VCH0qGjAJtIiHkhNabq7okMB16g", "expires_in": 432000, "token_type": "Bearer", "token_id": "ac21-9d7463be6cb8" }

Workaround:- We can only use the jf atc command when CLI is configured with access-token.

What we need:-

We need to have the functionality to create access-token when the cli is configured with username and password with the new access token API endpoint.

ggjulio commented 1 week ago

+1 that's a blocker for us.

The workaround is to continue using jf rt atc instead of jf atc