Generate API token for users through Jenkins API

Hello, everyone. I now use com.offbytwo.jenkins for Jenkins-related operations. I need a user name and password or token, when creating a jenkins Service. Because it is not convenient to save the user"s password, I want to operate through token. In addition to allowing users to query token under their Jenkins account, is it possible to generate token through Jenkins"s api or other methods? Thank you

Mar.01,2021

POST / user/$ {USER_NAME} / descriptorByName/jenkins.security.ApiTokenProperty/generateNewToken?newTokenName=$ {TOKEN_NAME}

reference: https://blog.csdn.net/qq_33745102

Menu