Azure Data Factory Setup

I have a private project that I want to read from Azure Data Factory. I created a token ‘my-token’ that never expires. I set a REST connection as ‘Anonymous’ and I’m passing my-token as a header.
Also the user related to the GET request does have the ‘System Administrator’ permission.

https://sonarcloud.io/api/projects/search?organization=my-org
Authorization: Bearer my-token-key
Content-Type: application/json

Error 403
{
“errors”: [{
“msg”: “Insufficient privileges”
}]
}

I also tried via Basic Authentication by using my credentials (Azure DevOps)
Error 401

How should I set the request method? I appreciate your feedback.

Hello @gerardo.trejo
Welcome to the SonarSource community!
The token is indeed the way to go for requests to SonarCloud. You must use yours as described with https://sonarcloud.io/documentation/user-guide/user-token/#how-to-use-a-token, i.e. not using Bearer token authentication, but basic authentication set with your token as login (and no password).
Let me know.

Best.
Sylvain

Actually I tried this

curl -u my_user:my_pwd https://sonarcloud.io/api/projects/search?organization=ulx-sonar – Status 401 “Unauthorized client error”
curl -u my_user:my_pwd https://sonarcloud.io/api/users/search – Status 401 “Unauthorized client error”

curl -u my_token: https://sonarcloud.io/api/projects/search?organization=ulx-sonar – Status 403 “Insufficient privileges”
curl -u my_token: https://sonarcloud.io/api/users/search – Status 200 - “OK”

Is it related to the System Administrator credential? If so, just to confirm and go back with my Administrator

Yes, GET api/projects/search requires admin privileges: https://sonarcloud.io/web_api/api/projects/search