Issue with GitLab Token Expiration in DevOps Platform Integrations in SonarQube

Hello,

I am experiencing an issue with the integration between SonarQube and GitLab. In the DevOps Platform Integrations section of SonarQube, the GitLab configuration appears to be correctly set up, and the token is valid for 12 months.


However, when I call the API to retrieve the list of GitLab projects using the following web service:

curl -u "USER:PWD" -X GET "https://[SONARQUBE_SERVER]/api/alm_integrations/search_gitlab_repos?almSetting=Gitlab

I receive the following error message:

{"errors":[{"msg":"Your GitLab token is expired"}]}

Despite the fact that the token is valid in the SonarQube UI and the integration is working properly when tested through the “Check configuration” button, the API still reports the token as expired.

I have already updated the token, but the issue persists. It seems that even though the token is correctly configured and valid, SonarQube is not recognizing it properly when querying the GitLab repositories via the API.

Can anyone assist me with this problem or provide guidance on resolving it? Thank you in advance for your help.

Best regards,
Jérôme

Hey there.

You’ll notice that even after you setup the Gitlab integration, if you go to create a project in the UI, you are asked to provide another token.

This is to make sure that users with the Create Projects permission can only see projects they actually have access to.

This is the token being referred to here:

You can either update this in the UI, or by calling POST api/alm_integrations/set_pat

Hello,

Thank you Colin, I didn’t have this information. Everything is working now.

1 Like

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