Error running scanner in client

Hi,

When I am running scanner using the global tool and below is the cmd
dotnet sonarscanner begin /k:“testprojectkey2token” /d:sonar.login=“admin” /d:sonar.password=“admin1”

Above cmd is running successfully. And the admin credential is used to login to sonarqube server.

And when I created a token in sonarqube server using admin credential, so I replace the cmd with
dotnet sonarscanner begin /k:“testprojectkey2token” /d:sonar.login=“token-generated”

And error display as: The token you provided doesn’t have sufficient rights to check license.

Hi @yapeutat

First which version and edtion of SonarQube are you using ?

Thanks.

Mickaël

Hi Mickaël, I am using Community Edition * Version 8.6 (build 39681)

Thanks ! I wasn’t able to reproduce on my side. Do you have any specific setting on your instance that can forbid any token-based authentication maybe ?

I’m not quite sure that this is related, but if it works now on you side, then it’s good !

Oops sorry. I mixed up with other post I created earlier.

Do you have any specific setting on your instance that can forbid any token-based authentication maybe ?
Not that I know.

Actually this happened to me earlier too.
Scanner can run when I use username together with password.
But is not working when I use the token generated.

Can you double check if the token is correctly past or if it hasn’t been revoked ?

Yes it’s correctly passed and is not revoked.

Hi @yapeutat

Sorry for getting back late to you.

Can you test this token by calling an SQ API directly ? To see which kind of result you get.

Thanks in advance

Hi Mickaël,

Just found out the issue.

In scanner SonarQube.Analysis.xml,
http://sonarqubserver:9000
admin
password

If the SonarQube.Analysis.xml is set with the credential as above, then the scanner will only work when username + password provided.

If the SonarQube.Analysis.xml is set using token in the login attribute instead of username + password, then the scanner will work when token is provided.

Thanks for your help anyway!

Indeed, thanks and sorry !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.