Getting "insufficient privileges" error using sonarqube project dashboard api for code coverage

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) : 7.9.1 Enterprise Edition
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve: Using sonar token to fetch project code coverage using api’s
  • what have you tried so far to achieve this: Refer api docs and created token with required permissions but still getting “Insufficient privileges” error.
https://<sonarqube endpoint>/api/measures/component?component=<sonarkey>&metricKeys=coverage

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

curl --location 'https://<endpoint>/api/measures/component?component=<sonarkey>&metricKeys=coverage' \
--header 'Authorization: Bearer <TOKEN>'

@v123604_ual in Authorization change Bearer to Basic and give pat token and try it out.
if you are using postman in username section give pat token