'how to get http password in gerrit rest api

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

[auth]
      type = LDAP
      gitBasicAuthPolicy = LDAP

I'm calling rest api by curl

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

it's not work



Solution 1:[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.

Solution 2:[2]

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

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcelo Ávila de Oliveira
Solution 2 Dharman
Solution 3 Roman