How to get custom api tokens

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to get custom api tokens

rajesh pilla
I am trying to generate tokens for different use-cases and I am looking for a way to get token value by using token name. Can anyone help me with this?
I am able to get legacy token with  below script, want to achieve the same to get other token values.

user = hudson.model.User.get('admin')
prop = user.getProperty(jenkins.security.ApiTokenProperty.class)
println(prop.getApiTokenInsecure())


Thanks in advance

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3c34962d-c86f-43dd-a19c-778bab8d2a33%40googlegroups.com.