Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

jfrog plugin using access token not working #12

Open
fiorillj opened this issue Feb 3, 2023 · 2 comments
Open

jfrog plugin using access token not working #12

fiorillj opened this issue Feb 3, 2023 · 2 comments
Labels
question Further information is requested

Comments

@fiorillj
Copy link

fiorillj commented Feb 3, 2023

How can we help?

Looks like this issue is explained in jfrog/jfrog-cli#1616 (comment)

I can configure the plugin with user and password and all is fine. But when I use an access token the job fails with Unauthorized:
(All hostnames and account info removed)

The plugin runs this in the jenkins pipeline:

/usr/local/bin/jf c add artifactory --user=x --password x --url=xxxx --artifactory-url=https://xxxx --distribution-url=https://xxxx/distribution --xray-url=https://xxxx/xray --interactive=false --overwrite=true
[jenkins@john-jfrog-test ~]$ /usr/local/bin/jf rt ping
10:04:38 [🚨Error] server response: 401 Unauthorized
{
"errors": [
{
"status": 401,
"message": "Bad credentials"
}
]
}
[jenkins@john-jfrog-test ~]$

Adding the workaround from issue 1616 resolves the issue from the shell but how do I implement these options in the plugin?
"--enc-password=false --basic-auth-only"

/usr/local/bin/jf c add artifactory --user=x --password=x --url=https://xxxx --artifactory-url=https://xxxx/artifactory --distribution-url=https://xxxx/distribution --xray-url=https://xxxx/xray --interactive=false --overwrite=true --enc-password=false --basic-auth-only
[jenkins@john-jfrog-test ~]$
[jenkins@john-jfrog-test ~]$ /usr/local/bin/jf rt ping
OK

jf version 2.34.1
JFrog Plugin Version1.0.5

Thanks.

@fiorillj fiorillj added the question Further information is requested label Feb 3, 2023
@yahavi
Copy link
Collaborator

yahavi commented Mar 18, 2023

@fiorillj,
Thanks for reporting this issue.
This issue is only relevant for reference tokens (64 characters tokens). Also could it be that your Artifactory URL doesn't end with /artifactory?

/usr/local/bin/jf c add artifactory --user=x --password x --url=xxxx --artifactory-url=https://xxxx/ --distribution-url=https://xxxx/distribution --xray-url=https://xxxx/xray --interactive=false --overwrite=true

The 401 error for reference tokens is already resolved in Artifactory >= 7.42.0. What is your Artifactory version?

@fiorillj
Copy link
Author

fiorillj commented Mar 20, 2023 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants