My understanding is that it is a multi part affair.
- Add a Token in the TeamCity GUI (Versioned Settings > Tokens)
- Reference that Token in your Kotlin (which you have done above)
- In your build configuration, use the parameter that you have defined in your Kotlin.
So if you do something like:
params{
add {
param("system.myGithubPassword)", "credentialsJSON:78098495-5f8c-4935-82b5-03eafaf2adde")
}
}
Then you should see (in the GUI) that your project now has a system parameter called myGithubPassword with a (hidden) value. You should also see (in the GUI) the projects/parameters for which that Token is being used - shown in the 'Tokens' page. You can then refer to %system.mygithubpassword%
in any build locations that can handle TeamCity parameter substitution and TeamCity should handle parameter -> token -> password substitution.
From your description, you may be setting the token and parameter correctly, but then not using the parameter how you want/expect in the Build configuration.
That is how I think that it should work, but like you I've been finding the docs a bit tricky to follow on this...
https://www.jetbrains.com/help/teamcity/storing-project-settings-in-version-control.html#Managing+Tokens