How can i access sonar metrics without auth via https link?

Viewed 205

I have a GitLab repo and want to show some badges on it.

If I logged in Sonar, I can access metrics, but I can't without authorization. GitLab badges on repo

This is a sample request:

https://sonar3.myappname.com/api/project_badges/measure?project=return-api-sonar&metric=code_smells

Can I pass username and password or token inside a https request?

https://username@password/sonar3.myappname.com/api/project_badges/measure?project=return-api-sonar&metric=code_smells

Or how can make this request public ? Thanks

1 Answers

You would need to make your project public (which has implications of anyone being able to access your source code) and then you wouldn't need any authentication. Badges are not supported for private projects; this is pending vendor implementation.

If your project is already public (but the server itself requires authentication), you can just embed a token in the URL, i.e. https://token@sonar3.myappname.com/api/...

Related