0

I want to look up some review comments on Gerrit via the REST API. I tried a few methods, including Gerrit's official documentation, and nothing changed the fact that I was an anonymous user. The authentication configuration in the gerrit.config is as follow:

[auth]
    type = LDAP
    gitBasicAuthPolicy = LDAP

I'm calling rest api by curl

$ curl --digest --user LDAP_user:LDAP_password \
      https://gerrit.example.com/a/path/to/api

It does not work.

3 Answers 3

1

Digest authentication was removed from Gerrit in release 2.14. Remove the "--digest" parameter and the "curl" command will work.

More info in Gerrit 2.14 release notes here.

Sign up to request clarification or add additional context in comments.

4 Comments

I have removed digest parameter but it doesn't work. My gerrit version is:3.1.7
What's the error? Can you log in UI with the same user/password?
Yes I can login in UI with the same user/password. But it does'nt work in rest api. I don't know if it has anything to do with ldap configuration
I use "HTTP_LDAP" instead of "LDAP" in the "gitBasicAuthPolicy" configuration, but I think this isn't an issue. You need to show what is the EXACT command you're running and what is the error you're getting.
0

HTTP_PASSWORD maybe the answer which can be found in account settings.

And then

curl -u USR_NAME:HTTP_PASSWORD https://gerrit.XX.com/a/path/to/api

Comments

0

What's your Gerrit version?
2.14 and newer require basic auth, as already mentioned by Marcelo (maybe you have to explicitly give --basic ).
2.13 and older use digest; you will also be interested in this post if you are using versions that old.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.