Get value of token through API

Hi,

Is there any way to get, through API, or a curl sentence, the value of the token associated to the user? For example, if I execute this command:

curl -u admin:admin http://my_sonarqube_instance.com…

I’d like to obtain the values of the tokens that belong to the user admin. I’ve seen in SonarQube documentation (https://gazelle.ihe.net/sonar/web_api/api/user_tokens) that the one that most approaches to my objective is GET api/user_tokens/search, but I’ve realised that this API order only shows the name and creation data of those tokens.

Thanks for your help. Regards.

Hey Carlos,

A token cannot be retrieved after it has been generated. This would represent a large security risk (basically having another user’s password as far as SonarQube is concerned).

The best thing to do is provision a new token if you lose it, begin to use that token for authentication where necessary and revoke the ones you no longer have access to.

Colin

2 Likes