waitForQualityGate is not working

SonarQube Version : 8.4.2
SonarQube Scanner version : 3.2.0.1227

Issue:
We are trying to scan the cobal files and upload them to SonarQube server and based on the analysis we are trying to invoke the quality check. Scan is successful and its uploaded to SonarQube server as well, how ever when we invoke waitForQualityGate function in our Jenkins pipeline we are getting 401 error.

What we tried so far:
Based on previous discussion in sonar community and on internet we have tried all the scenarios and our options are exhausted.
Scenarios tried so far:

  1. used credentials id in waitForQualityGate function
  2. hard coded the token in both withSonarQubeenv function and waitForQualityGate function

Observation:
It was mentioned in a blog that if we pass the user name and password for sonar analysis, this cred wont be accepted for waitForQualityGate, as this will only take token as the cred. Can you please clarify on this as well.

Please note that we are not facing any issue when performing the waitForQualityGate for maven, dotnet technology.

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.4.2 → 8.9.10 → 9.7 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.

We have pre production Sonarqube instance with version 9.4, when we tried to configure with that we are still facing the same issue with waitForQualityGate function where it throws 401 error. Sonar analysis and upload is working fine.