Not authorized. Please check the user token in the property 'sonar.token' or the credentials in the

We are having issues on the Sonarqube Stage in Jenkins Pipeline.

We are Getting this error below.

[Sonarqube] > Not authorized. Please check the user token in the property ‘sonar.token’ or the credentials in the properties ‘sonar.login’ and ‘sonar.password’.

Here is our code below

--- this code is working using sonar.login

export SONAR_TOKEN="Our sonar token" /apps/installers/gradle-8.5/bin/gradle sonar -Dsonar.login=$SONAR_TOKEN --stacktrace echo "Execution of Sonarqube is done"

--- but after changing it to sonar.token we are getting Not Authorized issue.

export SONAR_TOKEN="Our sonar token" /apps/installers/gradle-8.5/bin/gradle sonar -Dsonar.token=$SONAR_TOKEN --stacktrace echo "Execution of Sonarqube is done"

Hey there.

What version of SonarQube are you using? You can find this info in the footer of your instance.

Hello Colin, We are using the Sonarqube 10.1 version.

The previous working version is 7.1

Thanks!

First of all, you really should upgrade from v10.1 to v10.6. v10.1 is an EOL version of SonarQube. However, that version should perfectly support sonar.token.

Are you sure that sonar.login isn’t specified somewhere else? I’m thinking of a build.gradle file or something similar. Having multiple values set (sonar.login and sonar.token) can cause issues.

Just to confirm, sonar.login works fine for the v10.1 version?